Hostname: page-component-669899f699-2mbcq Total loading time: 0 Render date: 2025-04-28T23:23:52.722Z Has data issue: false hasContentIssue false

FUNCTIONAL PEARL: Enumerating the rationals

Published online by Cambridge University Press:  25 October 2016

JEREMY GIBBONS
Affiliation:
University of Oxford, Parks Road, Oxford, UK [email protected], [email protected]
DAVID LESTER
Affiliation:
University of Manchester, Manchester, UK [email protected]
RICHARD BIRD
Affiliation:
University of Oxford, Parks Road, Oxford, UK [email protected], [email protected]
Rights & Permissions [Opens in a new window]

Extract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Every lazy functional programmer knows about the following approach to enumerating the positive rationals: generate a two-dimensional matrix (an infinite list of infinite lists), then traverse its finite diagonals (an infinite list of finite lists).

Type
Functional Pearls
Copyright
2006 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.