Am Di., 29. Okt. 2019 um 14:40 Uhr schrieb <xxxxxx@ccrma.stanford.edu>: > > Thank you for including s7 in srfi-177. I thought you might like an > hygenic > version of that code: > > (define-macro (keyword-lambda formals-and-keys . body) > ((lambda (formals keyword-symbols) > `(with-let (unlet) ; or (inlet (unlet)) -- more explicit > (lambda* (,@formals ,@(map (lambda (sym) `(,sym #f)) > keyword-symbols)) > ,@body))) > (split-last formals-and-keys))) But what do you do if `with-let' has been overwritten in the usage environment of the macro? Marc > > I think the keyword-call macro is already hygienic. "with-let" > evaluates its body in the given environment. s7 has > first-class environments, so it doesn't need define-syntax and > its friends. > > Here are tests, similar to yours: > > (define (writeln x) (write x) (newline)) > > (let ((lambda* gcd) > (list abs) > (a 321) > (split-last 42) > (cond if)) > (define y (keyword-lambda (a b (c d)) (list a b c d))) > (writeln (y 1 2)) > (writeln (keyword-call y 1 2 ())) > (writeln (keyword-call y 1 2 (c 3))) > (writeln (keyword-call y 1 2 (d 4 c 3)))) > > (set! list abs) > > (define z (keyword-lambda (a b (c d)) (list a b c d))) > (writeln (z 1 2)) > (writeln (keyword-call z 1 2 ())) > (writeln (keyword-call z 1 2 (c 3))) > (writeln (keyword-call z 1 2 (d 4 c 3)))) > > Please let me know if I've missed something! > > -- Prof. Dr. Marc Nieper-Wißkirchen Universität Augsburg Institut für Mathematik Universitätsstraße 14 86159 Augsburg Tel: 0821/598-2146 Fax: 0821/598-2090 E-Mail: xxxxxx@math.uni-augsburg.de Web: www.math.uni-augsburg.de/alg/mitarbeiter/mnieper/