clojure-dev

Ben Sless 2022-04-05T15:43:46.523419Z

Is this a bug?

(#'clojure.core.protocols/iter-reduce [1 2 3] conj)
Execution error (ClassCastException) at user/eval10101 (REPL:1).
class java.lang.Long cannot be cast to class clojure.lang.IPersistentCollection (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')

Ben Sless 2022-04-05T15:44:24.960529Z

iter-reduce binds the first value of ret to be the first element from the iterator and not (f)

ghadi 2022-04-05T15:46:59.145899Z

not a bug. The init-less reduce arity (which is awful, don't call it!) is documented to call the reducing function on the first two elements of the collection

ghadi 2022-04-05T15:47:13.264669Z

If val is not supplied,
  returns the result of applying f to the first 2 items in coll
(docstring of reduce)

ghadi 2022-04-05T15:47:47.350609Z

transduce and clojure.core.reducers/reduce operate differently.

😭 1
Ben Sless 2022-04-05T15:48:05.113879Z

👍 thanks