partitionv with pad gives incorrect results

Description

partitiionv is new in 1.12.0-alpha1. I get the wrong answer when using a pad argument:

(partitionv 4 4 [0 0 0] (range 10))
;=> ([0 1 2 3] [4 5 6 7] 8 9 0 0)

I expected: ([0 1 2 3] [4 5 6 7] [8 9 0 0])

Also, note that (partition 4 4 [0 0 0] (range 10)) works as expected.

Problem: in the new partitionv code, if there is a padded final group, the last padded partition needs to be grouped into a surrounding list of partitions to be returned from the lazy-seq as a partition not a group of elements.

Approach: Group the last padded partition in a list.

Patch: clj-2715-2.patch

Screened by: Alex Miller

Environment

None

Attachments

2
  • 12 Oct 2022, 06:24 PM
  • 03 Aug 2022, 05:48 PM

Activity

Show:

Alex MillerDecember 7, 2022 at 9:54 PM

Applied for next 1.12 alpha

Alex MillerOctober 12, 2022 at 6:23 PM

-2 patch fixes a whitespace issue, improves the commit message, and has more diff context but is otherwise the same, attribution retained

Alex MillerAugust 6, 2022 at 3:05 PM

Indeed, thanks!

Fixed

Details

Assignee

Reporter

Approval

Ok

Patch

Code and Test

Priority

Affects versions

Fix versions

Created August 3, 2022 at 5:36 PM
Updated December 7, 2022 at 9:54 PM
Resolved December 7, 2022 at 9:54 PM

Flag notifications