Re: a convenience idea for test functions

2012-04-18 Thread Dmitri
That is an excellent point, and the macro is actually a very nice approach, thanks for the help. On Apr 18, 1:07 am, Sean Corfield wrote: > On Tue, Apr 17, 2012 at 9:16 PM, Dmitri wrote: > > (map? foo bar baz) would return bar if foo is a map and baz otherwise. > > To elaborate on Alan's respon

Re: a convenience idea for test functions

2012-04-17 Thread Sean Corfield
On Tue, Apr 17, 2012 at 9:16 PM, Dmitri wrote: > (map? foo bar baz) would return bar if foo is a map and baz otherwise. To elaborate on Alan's response, consider: (if (map? foo) (/ bar 0) baz) If map? were 'merely' a variadic function, (map? foo (/ bar 0) baz) would fail because (/ bar 0) would

Re: a convenience idea for test functions

2012-04-17 Thread Alan Malloy
IMO this is fairly absurd for a language default, but you can easily do this yourself in a number of ways. For example: (defmacro define-preds [& preds] (cons `do (for [pred preds] `(defmacro ~(symbol (str pred "+")) ~'[obj then else] (list '~'if (list '~pred ~'obj