1
votes

I started learning LISP and I heard that there is some kind of a trick to do recursion without using lables (only using : quote,atom,eq,car,cdr,cons,cond).

I gave it some thought but I can't think of a way doing this since the function I defined has no name.

I'm guessing its done using cond by I don't really see how...

[the question is how to implement recursion with the limitations as stated above]

1

1 Answers

5
votes

For anonymous recursion, you're going to need a fixed-point combinator, the most famous of which is known as the Y combinator. Richard Gabriel's "Why of Y" is a good article which derives and justifies Y in Scheme.