Hostname: page-component-5c6d5d7d68-pkt8n Total loading time: 0 Render date: 2024-08-22T20:28:26.549Z 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, [email protected], [email protected]
DAVID LESTER
Affiliation:
University of Manchester, Manchester, [email protected]
RICHARD BIRD
Affiliation:
University of Oxford, Parks Road, Oxford, [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.