mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:23:17 -09:00
fiddle
This commit is contained in:
parent
fcdf3c6c9d
commit
131cfb08d1
@ -33,7 +33,7 @@
|
|||||||
[& ls] (let [r# (reverse ls)]
|
[& ls] (let [r# (reverse ls)]
|
||||||
`(comp ~@r#)))
|
`(comp ~@r#)))
|
||||||
|
|
||||||
(defmacro static-fn
|
(defmacro s-fn
|
||||||
"wraps java static methods in a lambda so they can be passed as function objects"
|
"wraps java static methods in a lambda so they can be passed as function objects"
|
||||||
[f] `(fn [v#] (~f v#)))
|
[f] `(fn [v#] (~f v#)))
|
||||||
|
|
||||||
@ -90,18 +90,14 @@
|
|||||||
v is a vector of values of length N
|
v is a vector of values of length N
|
||||||
|
|
||||||
this function returns a vector where each value is the result of applying
|
this function returns a vector where each value is the result of applying
|
||||||
an f from fs to the corresponding v from vs"
|
an f from fs to the corresponding value from v"
|
||||||
[& args]
|
[& args]
|
||||||
(->> (zipmap (drop-last args)
|
(->> (zipmap (drop-last args)
|
||||||
(last args))
|
(last args))
|
||||||
(mapv #((first %) (second %)))))
|
(mapv #((first %) (second %)))))
|
||||||
|
|
||||||
(def p partial)
|
|
||||||
|
|
||||||
(def a apply)
|
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(map (static-fn Long/parseLong) ["123" "456"])
|
(map (s-fn Long/parseLong) ["123" "456"])
|
||||||
input-cache
|
input-cache
|
||||||
|
|
||||||
(apply-each #(* % 2) #(+ % 5) 5 10)
|
(apply-each #(* % 2) #(+ % 5) 5 10)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user