Open ilyash opened 4 years ago
Thinking. Maybe like this (not tested):
doc start - fetch first page
doc step - fetch second and on page, based on output from body()
doc body - process the page and extract "next token" to feed into step()
F paginate(start:Fun, step:Fun, body:Fun) {
cont = body(start())
while cont is not Null {
cont = body(step(cont))
}
}
Also to do: Iter
for pagination-based-fetched items
Paginator facility (or method). The intended use is to support APIs that require pagination.
Usage might look like like the following: