Fixed
Details
Assignee
UnassignedUnassignedReporter
Ghadi ShaybanGhadi ShaybanApproval
OkPatch
Code and TestPriority
MajorFix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Ghadi Shayban
Ghadi ShaybanApproval
Ok
Patch
Code and Test
Priority

Fix versions
Created January 31, 2020 at 11:11 PM
Updated January 14, 2022 at 4:35 PM
Resolved January 13, 2022 at 10:05 PM
Problem
Consuming iterated/pagenated APIs is a frequent need for Clojure devs but writing code that consumes them efficiently and handles various flow patterns is nuanced.
Approach
Add a generator function to clojure.core for iterated API calls, that can represent iteration e.g. HTTP endpoints that return continuation tokens.
Background
Examples of tasks within this problem category include:
using aws-api everyday - lots of APIs return continuation tokens and you have to stitch calls together
walking up a superclass hierarchy: Long -> Number -> Object
collecting exception cause chains
Common approaches use some combination of
iterate
andtake-while
and while expedient, this approach couples the "beget" part of the iteration protocol with the "has-more?" part of the protocol. A ticket that attempted to address iterated protocols was CLJ-1906. Rich created an exampleiteration
function that provided an a la carte iterated API consumer.Screened By: Fogus
Patch: clj-2555-iteration.patch