Skip to content

Commit 527b330

Browse files
minerpuredanger
authored andcommitted
CLJ-2715 partitionv - group last padded partition for inclusion in seq of partitions
1 parent 0988738 commit 527b330

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/clj/clojure/core.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7375,7 +7375,7 @@ fails, attempts to require sym's namespace and retries."
73757375
(let [p (into [] (take n) s)]
73767376
(if (= n (count p))
73777377
(cons p (partitionv n step pad (nthrest s step)))
7378-
(into [] (take n) (concat p pad))))))))
7378+
(list (into [] (take n) (concat p pad)))))))))
73797379

73807380
(defn partitionv-all
73817381
"Returns a lazy sequence of vector partitions, but may include

test/clojure/test_clojure/sequences.clj

+4
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,8 @@
781781

782782
(partition 5 [1 2 3]) ()
783783

784+
(partition 4 4 [0 0 0] (range 10)) '((0 1 2 3) (4 5 6 7) (8 9 0 0))
785+
784786
; (partition 0 [1 2 3]) (repeat nil) ; infinite sequence of nil
785787
(partition -1 [1 2 3]) ()
786788
(partition -2 [1 2 3]) () )
@@ -809,6 +811,8 @@
809811
(partitionv 1 []) ()
810812
(partitionv 1 [1 2 3]) '((1) (2) (3))
811813

814+
(partitionv 4 4 [0 0 0] (range 10)) '([0 1 2 3] [4 5 6 7] [8 9 0 0])
815+
812816
(partitionv 5 [1 2 3]) ()
813817

814818
(partitionv -1 [1 2 3]) ()

0 commit comments

Comments
 (0)