On Fri, Jul 17, 2009 at 11:21 AM, Mark Addleman<mark_addle...@bigfoot.com> wrote: > > On Jul 17, 2:35 am, Nicolas Oury <nicolas.o...@gmail.com> wrote: >> Hello, >> >> Can this construct handle higher-order functions? > > Nope :) > > Chouser brought up this point in IRC. It's not even clear what the > syntax would look like.
I suppose you could provide named-arg-aware high order functions with their own syntax. (named-map subtract :from (range 0 30 3) :take (range 10)) But you'd need everything -- filter, reduce, etc... There is something that can be done to make a normal call look more ... normal. That is, instead of: (named-call subtract :from 10 :take 2) you'd prefer: (subtract :from 10 :take 2) Well, that's just a matter of writing a defn-named-args macro: (defn-named-args subtract [from take] (- from take)) Which would expand to something like: (do (defn subtract-func [from take] (- from take)) (defmacro subtract [& args] `(named-call subtract-func ~...@args))) This actually came up in IRC too. :-) Note it builds directly on the named-call macro you've already got. Also note that it enforces the inability to use this 'subtract' in high order functions because it's now a macro. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---