Skip to content

Instantly share code, notes, and snippets.

@postspectacular
Created April 16, 2015 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save postspectacular/c95cff19bc82ba919813 to your computer and use it in GitHub Desktop.
Save postspectacular/c95cff19bc82ba919813 to your computer and use it in GitHub Desktop.
Clojurescript eduction reduce bug?
;; CLJS 0.0-3196
(reduce conj [] (eduction (filter identity) [1 2 3 4]))
;; [1 2 3 4]
(defrecord Foo [state])
(defn add-foo [foo x] (Foo. (conj (:state foo) x)))
(reduce add-foo (Foo. []) (sequence (filter identity) [1 2 3 4]))
;; => #cljs.user.Foo{:state [1 2 3 4]}
(reduce add-foo (Foo. []) (eduction (filter identity) [1 2 3 4]))
;; extra nil added :( - why?
;; => #cljs.user.Foo{:state [1 2 3 4 nil]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment