Skip to content

Comment on The Weird and Wonderful Characters of Clojure

Comments

I've been using Clojure for awhile now and it has never previously occurred to me that you could do:

    #(foo %2)
instead of
    (fn [_ arg2] (foo arg2))
Thanks!

Neither did I until I started writing about #( and decided to see what would happen. The joys of being nosey.

Nosey? Or maybe "curious"? Explorer? Pioneer? Either way, thanks for writing about it.

Obviously, bear in mind that (comp foo second) may be preferable.

Slightly different use-case, as:

    (comp foo second)
Is equivalent to:
    (fn [[_ x]] (foo x))
Not:
    (fn [_ x] (foo x))

+1.

How about:

   (comp foo second list)
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.