ClojureScript

Reduce produces additional final nil when used w/ eduction

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: 0.0-3269
  • Fix Version/s: 0.0-3308
  • Component/s: None
  • Labels:

Description

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(defn my-conj
  [acc x]
  (prn acc x)
  (conj acc x))

(reduce my-conj [] (eduction (map identity) [1 2 3]))
;; [] 1
;; [1] 2
;; [1 2] 3
;; [1 2 3] nil
;; [1 2 3 nil]

This seems to be a CLJS specific issue - the above works fine in CLJ1.7.0-beta1. On the other hand, reductions too doesn't suffer this behavior (in CLJS):

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(reductions my-conj [] (eduction (map identity) [1 2 3]))
;; [] 1
;; [1] 2
;; [1 2] 3
;; ([] [1] [1 2] [1 2 3])

Activity

Hide
David Nolen added a comment -

I cannot reproduce with 0.0-3269. Please feel free to reopen if more information can be supplied.

Show
David Nolen added a comment - I cannot reproduce with 0.0-3269. Please feel free to reopen if more information can be supplied.
Hide
Karsten Schmidt added a comment - - edited

I don't know, David - don't understand how this can be, since I just tried the same w/ 3269 and the extra `nil` still is happening (I first did use a clean setup as described in CLJS quickstart wiki). The below is from a figwheel REPL:

cljs.user=> *clojurescript-version*
"0.0-3269"

cljs.user=> (defn my-conj [acc x] (prn acc x) (conj acc x))
#<function cljs$user$my_conj(acc,x){
cljs.core.prn.call(null,acc,x);
return cljs.core.conj.call(null,acc,x);
}>

cljs.user=> (reduce my-conj [] (eduction (map identity) [1 2 3]))
[] 1
[1] 2
[1 2] 3
[1 2 3] nil
[1 2 3 nil]
Show
Karsten Schmidt added a comment - - edited I don't know, David - don't understand how this can be, since I just tried the same w/ 3269 and the extra `nil` still is happening (I first did use a clean setup as described in CLJS quickstart wiki). The below is from a figwheel REPL:
cljs.user=> *clojurescript-version*
"0.0-3269"

cljs.user=> (defn my-conj [acc x] (prn acc x) (conj acc x))
#<function cljs$user$my_conj(acc,x){
cljs.core.prn.call(null,acc,x);
return cljs.core.conj.call(null,acc,x);
}>

cljs.user=> (reduce my-conj [] (eduction (map identity) [1 2 3]))
[] 1
[1] 2
[1 2] 3
[1 2 3] nil
[1 2 3 nil]
Hide
Karsten Schmidt added a comment -

verified to still occur w/ 0.0-3269

Show
Karsten Schmidt added a comment - verified to still occur w/ 0.0-3269
Hide
Karsten Schmidt added a comment -

I you want, I can attach a zip of my test project...

Show
Karsten Schmidt added a comment - I you want, I can attach a zip of my test project...
Hide
David Nolen added a comment -

I wasn't quite careful enough when trying out your failing example. I see the problem, fix coming.

Show
David Nolen added a comment - I wasn't quite careful enough when trying out your failing example. I see the problem, fix coming.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: