Changes for clojure.core/defn

philos99 on Sat, 01 Oct 2011
;; You can use destructuring to have keyword arguments. This would be a
;; pretty verbose version of map (in an example a bit more verbose than
;; the first above):

(defn keyworded-map [& {function :function sequence :sequence}]
  (map function sequence))

;; You can call it like this:

user=> (keyworded-map :sequence [1 2 3] :function #(+ % 2))
(3 4 5)


;; The declaration can be shortened with ":keys" if your local variables 
;; should be named in the same way as your keys in the map:

(defn keyworded-map [& {:keys [function sequence]}]
  (map function sequence))
zkim on Sun, 26 Sep 2010
;; You can use destructuring to have keyword arguments. This would be a
;; pretty verbose version of map (in an example a bit more verbose than
;; the first above):

(defn keyworded-map [& {function :function sequence :sequence}]
  (map function seq))

;; You can call it like this:

user=> (keyworded-map :sequence [1 2 3] :function #(+ % 2))
(3 4 5)


;; The declaration can be shortened with ":keys" if your local variables 
;; should be named in the same way as your keys in the map:

(defn keyworded-map [& {:keys [function sequence]}]
  (map function sequence))
zkim on Fri, 30 Jul 2010
You can use destructuring to have keyword arguments. This would be a pretty verbose version of map (in an example a bit more verbose than the first above):

(defn keyworded-map [& {function :function sequence :sequence}]
  (map function seq))


You can call it like this:

user=> (keyworded-map :sequence [1 2 3] :function #(+ % 2))
(3 4 5)


The declaration can be shortened with ":keys" if your local variables should be named in the same way as your keys in the map:

(defn keyworded-map [& {:keys [function sequence]}]
  (map function sequence))
pkolloch on Thu, 29 Jul 2010
You can use destructuring to have keyword arguments. This would be a pretty verbose version of map (in an example a bit more verbose than the first above):

(defn keyworded-map [& {function :function sequence :sequence}]
                  (map function seq))


You can call it like this:

user=> (keyworded-map :sequence [1 2 3] :function #(+ % 2))
(3 4 5)


The declaration can be shortened with ":keys" if your local variables should be named in the same way as your keys in the map:


(defn keyworded-map [& {:keys [function sequence]}]
                  (map function sequence))
pkolloch on Thu, 29 Jul 2010
You can use destructuring to have keyword arguments. This would be a pretty verbose version of map:


(defn keyworded-map [& {function :function sequence :sequence}]
                  (map function seq))


You can call it like this:


user=> (keyworded-map :sequence [1 2 3] :function #(+ % 2))
(3 4 5)