On Sat, Aug 13, 2011 at 1:57 PM, Thorsten Wilms <t...@freenet.de> wrote: > On 08/13/2011 06:45 PM, jaime wrote: >> Are there other functions for the same purpose? > > I don't see how there could be, for the very same purpose. Though you might > want to consider splitting up functions some more, instead.
I think he means "other functions whose main use is as arguments to HOFs, rather than called directly". In which case the functions returned by "constantly" form another family of such. Though we could get rid of that if we added a reader macro analogous to #(x) but that expanded into (fn [] x) rather than (fn [] (x)) as #(x) does. Perhaps #[x]? This could replace constantly, e.g. #[0] == (constantly 0), but also do a few other things, like #[[%1 (* 2 %2)]] takes two arguments and producing a vector with one of the arguments and then the other doubled, which saves relative to #(vector %1 (* 2 %2)) and makes it more visually clear that it outputs vectors. On the other hand, the same argument can be made against #[0], that this looks like it ought to return [0] rather than 0 when called. On the gripping hand, #{} is accepted as indicating sets, rather than functions that evaluate to maps. :) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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