Email list hosting service & mailing list manager


Re: I see little need Chongkai Zhu 18 Apr 2006 02:23 UTC

>Am I missing something subtle?  Per this example, we only have to write
>
>(let ((x (get-symbol)))
>(case x
> ((true) #t)
> ((false) #f)
> (else x)))

If you are allowed to add a line of "let" and then say that "=>" is not needed,
with the same argument, I can say that "case" is not needed in our language at
all. Whenever you need a "case", I can always write it as one line of "let"
and a "cond":

(define-syntax case
  (syntax-rules (else)
    ((case key
       ((atoms ...) result ...)
       ...)
     (let ((atom-key key))
       (cond ((memv atom-key '(atoms ...))
              result ...)
             ...)))
    ((case key
       ((atoms ...) result ...)
       ...
       (else else-result ...))
     (let ((atom-key key))
       (cond ((memv atom-key '(atoms ...))
              result ...)
             ...
             (else else-result ...))))))

BTW: This macro is in the first draft I send to srfi-editors. The editor asked me to
remove it so you can find it in the current draft.

Sincerely,
Chongkai Zhu