Computing Integer Sequences: Filtering vs Generation (Functional Pearl)
Ivano Salvo, Agnese Pacifico

TL;DR
This paper compares filtering and generation strategies for computing integer sequences using Haskell, illustrating their differences and efficiencies, and discusses analogous C implementations to foster cross-paradigm insights.
Contribution
It introduces a comparative analysis of filtering versus generation methods for sequence computation in functional programming, with insights applicable across programming paradigms.
Findings
Filtering and generation approaches have distinct performance trade-offs.
Cross-paradigm considerations enhance understanding of sequence computation.
Haskell and C implementations illustrate different algorithmic strategies.
Abstract
As a report of a teaching experience, we analyse Haskell programs computing two integer sequences: the Hamming sequence and the Ulam sequence. For both of them, we investigate two strategies of computation: the first is based on filtering out those natural numbers that do not belong to the sequence, whereas the second is based on the direct generation of num- bers that belong to the sequence. Advocating cross-fertilisation among ideas emerging when programming in different programming paradigms, in the background, we sketch out some considerations about corresponding C programs solving the same two problems.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · semigroups and automata theory · Formal Methods in Verification
