Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
On Barron and Strachey's Cartesian Product Function (2007) [pdf] (brics.dk)
2 points by aragonite on May 24, 2024 | hide | past | favorite | 1 comment


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: