Created
August 24, 2010 17:40
-
-
Save paulosuzart/547948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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