Email list hosting service & mailing list manager

s7 suggestion bil@xxxxxx (29 Oct 2019 13:40 UTC)
Re: s7 suggestion Lassi Kortela (29 Oct 2019 15:15 UTC)
Re: s7 suggestion bil@xxxxxx (29 Oct 2019 15:56 UTC)
Re: s7 suggestion Lassi Kortela (29 Oct 2019 16:19 UTC)
Re: s7 suggestion Lassi Kortela (29 Oct 2019 16:32 UTC)
Re: s7 suggestion bil@xxxxxx (29 Oct 2019 17:53 UTC)
Re: s7 suggestion Lassi Kortela (29 Oct 2019 18:06 UTC)
Re: s7 suggestion John Cowan (01 Nov 2019 21:26 UTC)
Re: s7 suggestion Lassi Kortela (01 Nov 2019 21:35 UTC)
Re: s7 suggestion John Cowan (01 Nov 2019 23:03 UTC)
&key vs :key in the lambda list Lassi Kortela (01 Nov 2019 23:17 UTC)
Re: &key vs :key in the lambda list John Cowan (01 Nov 2019 23:18 UTC)
Re: &key vs :key in the lambda list Lassi Kortela (01 Nov 2019 23:27 UTC)
Syntax for hygienic vs non-hygienic keywords Lassi Kortela (01 Nov 2019 23:33 UTC)
Re: allow-other-keys bil@xxxxxx (29 Oct 2019 19:51 UTC)
Re: s7 suggestion Marc Nieper-Wißkirchen (29 Oct 2019 16:32 UTC)
Re: s7 suggestion Lassi Kortela (29 Oct 2019 16:53 UTC)
Re: s7 suggestion bil@xxxxxx (29 Oct 2019 17:10 UTC)
Including 177 in s7? Lassi Kortela (29 Oct 2019 17:34 UTC)

Re: s7 suggestion Marc Nieper-Wißkirchen 29 Oct 2019 16:32 UTC

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/