Hello!

Le vendredi 20 décembre 2024 à 10:15 +0100, Maxime Devos a écrit :
> (define-syntax hello
>   (lambda (stx)
>     (syntax-case stx ()
>       (_
>        (begin
>          (format (current-error-port) "Hello!\n")
>          (datum->syntax #f "hello"))))))
>  
> You can simplify this to:
>  
> (define-syntax hello
>   (lambda (stx)
>      (format (current-error-port) "Hello!\n")
>      (datum->syntax #f "hello")))

This was an eye-opening moment for me: syntax-case is its own thing and
I don’t need the full define-syntax / lambda / syntax-case combo.

> I wonder, did you copy-paste all four blocks (both the define-syntax
> forms and the ,expand) at the same time, or one-by-one?

Oops, I was evaluating everything at once, so I did not notice the
format took place at definition time.

> Another option is to just let ‘hello’ and ‘world’ be procedure (that
> happen to accept syntax and produce syntax)

I’ll have to examine my new options now that I can think outside the
define-syntax / lambda / syntax-case box.

Anyway, thank you again for your help.

Best regards,

Vivien

Reply via email to