Apply a list of function to parameter, clojure -
(def ops '(+ - * /)) (map #(% 2 5) ops) gives
(5 5 5 5) this doesn't make sense me. why return list of 5 instead of results of function calls?
the problem '(+ - * /) list of symbols, not list of functions. symbols implement afn , when supplied 2 arguments, function attempts symbol in first argument (2 here) , returns second argument (5 here) if lookup fails.
Comments
Post a Comment