Re: Some comments Wolfgang Corcoran-Mathe 30 Sep 2026 02:01 UTC

Zhu,

On 2026-09-03 22:56 +0800, Zhu Zihao wrote:
> I don't understand why it can't be implemented in `syntax-rules` ...
>
> Therefore, an implementation like
>
>   (define-syntax endianness
>     (syntax-rules ()
>       ((endianness name)
>        (case 'name
>          ((big) 'big)
>          ((little) 'little)
>          (else (error "Invalid endianness type" 'name))))))

I don’t understand this either, but I understand the use of ‘case’ in
this example even less!  Why didn’t you just write:

    (syntax-rules (big little)
      ((_ big) 'big)
      ((_ little) 'little)
      ((_ e) (syntax-error "bad endianness" e)))

You get an expansion-time error if the identifier is wrong.  Surely
this is portable R7RS?

(Sorry, the message I just sent to the 281 list will repeat some of
this.)

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>