On Wed, Oct 21, 2009 at 11:50 PM, samppi <rbysam...@gmail.com> wrote:

> Oh, no. I was just wondering if there was a standard variable devoted
> to it. A symbol would be aesthetically less clutter than #(%), even if
> it'd take more typing. But if there isn't any other than the slow
> apply function, I'm happy with #(%) too. :)


Why settle?

(definline call [arg] `(~arg))

user=> (defn foo [] (println "foo!"))
#'user/foo
user=> (foo)
foo!
nil
user=> (call foo)
foo!
nil
user=> (defn bar [] (println "bar!"))
#'user/bar
user=> (doall (map call [foo bar]))
foo!
bar!
(nil nil)

And since it's definlined, it should be no slower to (call foo) than to
(foo) when not passing call to a higher-order function such as map, and if
you do, it should be no slower than passing #(%).

--~--~---------~--~----~------------~-------~--~----~
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