vix.ing · top · new · best · stats · spec

Computing Integer Sequences: Filtering vs Generation (Functional Pearl)

2018/07/31 by Ivano Salvo, Salvo, Ivano, Agnese Pacifico +1
Computer Science · #FOS: Computer and information sciences #Formal Methods in Verification #Logic, programming, and type systems #Programming Languages (cs.PL) #semigroups and automata theory

paper · pdf · doi:10.48550/arxiv.1807.11792

openalex publication_date 2018/07/31 · openalex created_date 2025/10/10 · openalex updated_date 2026/07/28

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.

Citations

Related