Den man. 1. jun. 2020 kl. 20.53 skrev Christopher Lemmer Webber <
[email protected]>:
> As I started typing this email and looking into the definition of case,
> I realized my assumptions are wrong.
>
> What I needed: something like case which dispatches on symbols, except
> not auto-quoting the arguments... I needed to evaluate them from the
> lexical environment. So:
>
> (let ([x 'foo])
> (caseish 'foo
> [(x) 'got-foo]
> [('x) 'got-quote-x])) ; => 'got-foo
>
Sounds like `evcase`:
https://docs.racket-lang.org/mzlib/mzlib_etc.html#%28form._%28%28lib._mzlib%2Fetc..rkt%29._evcase%29%29
> I figured: case is fast, and I'm pretty sure semi-magical... my
> intuitive sense was that it did some smart things on a compiler level
> that would probably be anything I'd hand-code (which would either use an
> alist or an immutable hashtable).
I think `case` were more important before `match` arrived.
If you want to see how `case` can be implemented without hash-tables, look
at
William D Clinger's paper:
http://scheme2006.cs.uchicago.edu/07-clinger.pdf
/Jens Axel
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CABefVgypomV3a%3DfcgyBtrvpyAS1FeH4YR3k3zEKR9One3Niu5Q%40mail.gmail.com.