Closed prikhi closed 7 years ago
I looked at the author's commit message, and they referenced the partition
function from Clojure. Based on the documentation for that function, it looks like the intended meaning is to drop step
number of elements counting starting from the previous partition before continuing. If step
is the same as the partition size, each element will be contained in exactly one partition (except for perhaps towards the end depending on greediness). If it is less than the partition size, there will be overlap in the partitions. If it is greater than the partition size, some elements will be skipped. I can submit a PR to fix the documentation in the morning.
@pzp1997 Thanks for checking it out, I updated the issue title to reflect what you found.
The docs for
groupsOfWithStep
say:With this example & test:
But shouldn't it be something like this(
groupsOfWithStep 2 1 (range 1 6)
):It should take 2, then drop 1, then take 2, right? Unless I'm misunderstanding the documentation.
Edit: Same with
greedyGroupsOfWithStep
?Should be
[ [1, 2, 3], [6] ]
?