This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-08-06
Channels
- # announcements (9)
- # babashka (22)
- # beginners (33)
- # cider (3)
- # clj-kondo (25)
- # clj-on-windows (1)
- # cljsrn (3)
- # clojure (38)
- # clojure-dev (10)
- # clojure-europe (17)
- # clojure-norway (45)
- # clojure-uk (3)
- # clojurescript (16)
- # code-reviews (20)
- # cursive (23)
- # data-science (18)
- # datomic (19)
- # fulcro (14)
- # funcool (5)
- # humbleui (34)
- # hyperfiddle (17)
- # jobs-discuss (3)
- # joyride (1)
- # malli (4)
- # off-topic (15)
- # polylith (10)
- # portland-or (2)
- # reitit (7)
- # releases (8)
- # shadow-cljs (11)
- # vim (30)
partition-all is documented to produce list partitions, but the transducer arity produces vector partitions. There’s already an issue about this from 2018: https://ask.clojure.org/index.php/3830/partition-docstring-should-mention-returns-vectors-transducer By now this it’s probably too late to change the behaviour, so I think it should be documented that the transducer arity produces vectors.
IMO there is a case to be made that the issue here is that the transducer arity isn't documented well enough.
this was an intentional choice (we carried it into the new partitionv-all)

so not planning to change the behavior, but updating the doc makes sense
still, it is a bit of a strange behavior.
(->> xs (partition-all 2) (mapv #(conj % y)))
for instance doesn't convert well into transducers, requiring a seq
to avoid the vector's conj
behavior.
(into [] (comp (partition-all 2)
(map #(conj (seq %) y)))
xs)
so you want to put on the front?
use cons?
(into [] (comp (partition-all 2) (map #(cons y %))) xs)
yes I know -in fact, I'd probably cons
from the beginning given that it communicates I'm working with a seq
abstracton - just digging for a case where this makes a difference
given that this was added 9 years ago and I'm not aware of anyone else filing an issue about it, I don't think it's too common