I wonder what's the reason behind not having:
(defn first
"Reducing function that returns the first value."
([] nil)
([x] x)
([x _] x))
? as a "complement" of last.
Edit:
Huh, interestingly enough it won't work at all:
(defn dbg-first
([] nil)
([x] x)
([x y]
(println ";; x" x "y" y)
x))
(transduce (comp
(filter odd?)
(map inc))
dbg-first [42]
[1 2 3 4])
;; x [42] y 2
;; x [42] y 4
;; => [42]
I'm getting convinced this issue can be closed. Happy Xmas! :)
I wonder what's the reason behind not having:
? as a "complement" of
last.Edit:
Huh, interestingly enough it won't work at all:
I'm getting convinced this issue can be closed. Happy Xmas! :)