Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 5503 days ago | link | parent

How about allowing cases to be functions?

  (case x
    [in _ '(1 3 5)] 'odd
    ..)


1 point by twilightsentry 5503 days ago | link

I've got a macro like that, which I call 'test. The problem with combining that and 'case is distinguishing functions and constants before the cases are eval'ed.

  (mac testlet (var expr . args)
    (letf ex (args)
           (if cdr.args
               `(if (,car.args ,var) ,cadr.args
                    ,(args cddr.args))
               car.xs)
      `(let ,var ,expr ,(ex args))))
Anyway, I'll probably just define 'casein as aw and rntz suggested.

-----