Process arbitrarily large lists without explicit recursion or abstract list functions?

Posted by Erica Xu on Programmers See other posts from Programmers or by Erica Xu
Published on 2011-11-26T22:53:19Z Indexed on 2011/11/27 2:01 UTC
Read the original article Hit count: 355

Filed under:
|
|

This is one of the bonus questions in my assignment.

The specific questions is to see the input list as a set and output all subsets of it in a list. We can only use cons, first, rest, empty?, empty, lambda, and cond. And we can only define exactly once.

But after a night's thinking I don't see it possible to go through the arbitrarily long list without map or foldr.

Is there a way to perform recursion or alternative of recursion with only these functions?

© Programmers or respective owner

Related posts about lisp

Related posts about recursion