On listing list prefixes
Olivier Danvy · ACM SIGPLAN Lisp Pointers · 1989
The Lisp Puzzles feature in Lisp Pointers, Volume 1, Number 6 proposed the following exercise: given a list, compute the list of its prefixes. Surprisingly, the solutions proposed in later issues all used intermediary copies and/or traversed the original list repeatedly. This note presents a higher-order solution that does not use copies and that traverses the original list only once. Further, this solution can be simply expressed by abstracting control procedurally.