infinite loop in 'partition' and 'partition-all' when 'step' or 'n' is not positive
If you pass a non-positive value of 'n' or 'step' to partition, you get an infinite loop. Here are a few examples:
(partition 0 [1 2 3])
(partition 1 -1 [1 2 3])
Cause: partition and partition-all do not check that n and step are positive.
Approach: Add checks to partition and partition-all that n and step are positive. To avoid redoing the arg validation, factored out internals of partition and partition-all to private internal-partition and internal-partition-all.
Screened by: Alex Miller
Thanks for looking so quickly Alex - sorry about that error in add-annotation. See clj-1647_3.patch
The patch changes add-annotation from defn- to defn but that seems unrelated to the intent of the patch?
I added clj-1647_2.patch to supersede other patches on this issue. Jira ref is added to commit msg and defn- used where possible (defn- is not defined until after one of the private fns but there is the ^rivate metadata added manually)
Patch looks basically good. Minor changes:
internal-partition and internal-partition-all should be marked private with defn-.
Commit description should start with "CLJ-1647"
Thanks for solving that mystery Matthew!