Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created August 24, 2010 17:40
Show Gist options
  • Save paulosuzart/547948 to your computer and use it in GitHub Desktop.
Save paulosuzart/547948 to your computer and use it in GitHub Desktop.
(ns ^{:doc "Helper functions that extends existing Clojure"
:author "Paulo Suzart"}
collext)
(defn
^{:doc "Returns a Vector containing f applied to every argument.
The f function is supposed to take one argument"
:test (fn []
(is (= [1 4 9 16 25 36] (mvector #(* % %) 1 2 3 4 5 6)))
(is (= ["TEST"] (mvector #(.toUpperCase %) "test"))))}
mvector [f & args]
(reduce #(cons %1 %2) (map f args) []))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment