Advertisement
Clojure

mapset

May 5th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn mapset [func ele]
  2.   (loop [elements ele
  3.          result []]
  4.     (if (empty? elements)
  5.       (set result)
  6.       (let [[first-value & another] elements]
  7.         (recur another (conj result (func first-value)))))))
  8.  
  9. (def v [1 2 3 4 5])
  10. (mapset inc v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement