Affiliation:
1. University of Aarhus, Aarhus, Denmark
2. University of Oxford, Oxford, England UK
Abstract
Over forty years ago, David Barron and Christopher Strachey published a startlingly elegant program for the Cartesian product of a list of lists, expressing it with a three nested occurrences of the function we now call
foldr
. This program is remarkable for its time because of its masterful display of higher-order functions and lexical scope, and we put it forward as possibly the first ever functional pearl. We first characterize it as the result of a sequence of program transformations, and then apply similar transformations to a program for the classical power set example. We also show that using a higher-order representation of lists allows a definition of the Cartesian product function where
foldr
is nested only twice.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Safer smart contract programming with Scilla;Proceedings of the ACM on Programming Languages;2019-10-10
2. Folding left and right over Peano numbers;Journal of Functional Programming;2019