Apply a callback to an array: Difference between revisions

add Clojure
(added Io. this seems like a duplicate task.)
(add Clojure)
Line 278:
(defvar *a* (vector 1 2 3))
(map-into *a* #'1+ *a*)
 
=={{header|Clojure}}==
 
;; apply a named function, inc
(map inc [1 2 3 4])
 
;; apply a function
(map (fn [x] (* x x)) [1 2 3 4])
 
;; shortcut syntax for a function
(map #(* % %) [1 2 3 4])
 
=={{header|D}}==
Anonymous user