I think you need to be careful not to prematurely optimise. If using apply becomes a problem, then drop in something more efficient, but until that point there's no reason not to use it.
- James On Oct 22, 1:27 am, samppi <[email protected]> wrote: > Ah, of course. But then I'm afraid of a time penalty cost, because > apply can take many arguments; would this be significant? Or should I > stick to #(%)? > > Clojure 1.0.0- > user=> (def a (constantly 55)) > #'user/a > user=> (time (dotimes [_ 500] (a))) > "Elapsed time: 0.389 msecs" > nil > user=> (time (dotimes [_ 500] (apply a))) > "Elapsed time: 0.923 msecs" > nil > > On Oct 21, 5:04 pm, James Reeves <[email protected]> wrote: > > > apply > > > On Oct 22, 12:49 am, samppi <[email protected]> wrote: > > > > Is there a standard function that takes one argument and calls it? > > > That is, the function equivalent to #(%). Or is that the best idiom > > > there is? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
