Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Transducers by
retagged by

As said in the title. There are several options to solve this problem:

  1. Introduce the 1-arity only for (partition n coll), which keeps the current standard pattern. It doesn't however allow the other arities and attempting to call (partition n step) or (partition n step coll) would result to unexpected behavior. That could be solved by checks of (seqable? step-or-coll) or similar things.
  2. The 1-arity would be passed as a vector. That could solve the arity collision problem but itwould break the pattern.
  3. Introduce a function like partition-xf that would do the work. The only issues could be that this function only returns a transducer, which is not common and that some people could expect the partition function to return a transducer if called like (partition n step), but I think it's just about getting used to it like everything else.

1 Answer

0 votes
by
...