2.8 (aux pagination)

Operating on paginated collections of objects.

2.8.1 Procedures

Procedure: page-next? page-number total-pages

Tell whether there is a next page after the current page-number according to total-pages.

Specification:

page-number (natural): Natural number representing the current page in a collection of pages.

total-pages (natural): Natural number representing the total number of pages in the collection.

Return value (boolean): True if the page after page-number exists. Otherwise, false.

Examples:

> (page-next? 5 20)
#t
> (page-next? 20 20)
#f
Procedure: page-prev? page-number OPT: start-page

Tell whether there is a previous page before page-number according to start-page.

Specification:

page-number (natural): Natural number representing the current page in a collection of pages.

start-page (natural): Optional. Natural number representing the first page in a collection of pages.

If not provided, it defaults to 1.

Return value (boolean): True if the page before page-number exists. Otherwise, false.

Examples:

> (page-prev? 2)
#t
> (page-prev? 1)
#f
> (page-prev? 4 3)
#t
> (page-prev? 3 3)
#f