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 <seancorfi...@gmail.com> wrote:
> On Tue, Apr 17, 2012 at 9:16 PM, Dmitri <dmitri.sotni...@gmail.com> 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 be evaluated and then passed as an
> argument, along with foo and baz.
>
> So, no, the simple answer is that you can't just make the test
> functions variadic and get the same behavior as an if form (hence
> Alan's suggestion of a macro-generating macro to create new macros for
> the forms you want).
>
> (Apologies if I'm laboring the point here)
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to