partition-by runs infinite loop when one element of infinite partition is accessed

Description

The reason is that partition-by counts and thus realizes each current partition to call itself recursively.

It seems like unexpected behavior, since the user may not intend to realize the entire partition.

Approach: Change from using seq to lazy-seq in its last line

Patch: clj-1764.patch

Screened-by: Alex Miller - I did a perf check too and seemed to be about the same, possibly even faster on average (gc effects mean there is a lot of deviation).

Environment

None

Activity

Show:
import
July 23, 2015, 8:36 PM

Patch as suggested by Leon, + test.

Completed

Assignee

Unassigned

Reporter

Leon Grapenthin

Labels

None

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Priority

Minor
Configure