top | item 46700546

(no title)

sethev | 1 month ago

In Clojure, vectors literally are functions. You can supply a vector (~= array) or map any place that a single parameter function is expected. So for example:

    (map v [4 5 7])
Would return you a list of the items at index 4, 5, and 7 in the vector v.

discuss

order

lioeters|1 month ago

That'a great example that demonstrates the idea in the article. And it concisely shows a functional insight in the language design of Clojure. I'm not a daily Lisp user yet, but as I learn more about it, I'm drawn to its many charms.

brabel|1 month ago

This particular case is unique to Clojure, I believe. You definitely can’t do that in Common Lisp , and Scheme I am not so sure. It was one of the main motivations for Rich Hickey to make the language more uniform so that a few functions work on any number of data structures.