p is a function. (p) - function call.
In your interpreter, evaluate p .
p <Return> ==> P :
Now evaluate (p) . Make sure you know how to kill your translator! (Perhaps there is a Stop button in Dr. Racket.)
(p)
Please note that nothing happens. Or at least nothing is visible. The interpreter rotates, eliminating tail calls (so, using about 0 memory), causing p .
As p and (p) evaluate different things, you should expect different behavior.
As for your second question: you define p as a function that returns itself. Again, try evaluating p and (p) with (define (p) p) and see what you get. My assumption (I use a computer on which I canβt install anything and which does not have a circuit) is that they will evaluate the same thing. (I can even argue that (eq? p (p)) will evaluate to #t .)
Charles Moss
source share