Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-16 Thread notallama
what i think would be nice here is multimethods taking multiple dispatch functions. (i'm not sure how you'd do that without breaking the default value syntax) so it'd try the first function, and if it doesn't match any method, then it tries the second, etc. then :default, then throws an exception

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-16 Thread Stuart Sierra
All multimethods have :default as the default fallback value, regardless of what the dispatch function is. But I assume that only works with single values. Maybe what you want is TWO multimethods, one that dispatches on the first value, then calls the second multimethod to dispatch on the other

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-15 Thread Parth Malwankar
On Nov 16, 12:36 am, samppi <[EMAIL PROTECTED]> wrote: > Is there a way to get a value—call it 'anything—so that (isa? anything > x) is always true for any x? > > I need this for multimethod dispatch—sometimes, I want a method to > ignore some of the stuff its dispatch function returns: > >   (d

A value that equals everything, or, ignoring things in multi-dispatch

2008-11-15 Thread samppi
Is there a way to get a value—call it 'anything—so that (isa? anything x) is always true for any x? I need this for multimethod dispatch—sometimes, I want a method to ignore some of the stuff its dispatch function returns: (defmulti a #(%1 %2)) (defmethod a [3 2] [x y] ...) ; in this met