Arc Forumnew | comments | leaders | submitlogin
1 point by lg 5502 days ago | link | parent

I think it'd be cool if a case-clause could be a fn, and if it is, and calling it on the case-arg returns true, then it matches. but maybe there should be a special sort of case for this called fncase or something.


1 point by rocketnia 5502 days ago | link

I like that idea, and it would be just as minor a change.

  - `(if (is ,var ',(car args))
  + `(if ((testify ,(car args)) ,var)
A difference is that in order to test against a literal value, you have to quote it. It's closer to Anarki's 'switch that way.

Oh, and akkartik and twilightsentry had just mentioned this idea elsewhere in this thread. :-p

-----