[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LetRec the way you want it IS in Common-lisp

re: In common-lisp you can get the reader to do this for you:
    ==> (prog1 nil (setf foo '#1=(a . #1#)))

I've been sitting on the sideline of this discussion wondering what the
heck anyone expected of LetRec in the line of "recursive" data structures.
It seemed just too obvious that the originator of this question had 
overlooked the #= and ## notation of the Common Lisp Reader for expressing
circular *constants*.

Now, maybe what he wanted was a freshly-consed-up copy of some circular
structure; say, something equivalent to  `#1=(a . ,#1#).  Just by
coincidence, the way Lucid's reader implements the #= and ## stuff is
awfully close to the way one might naively implement backquote; so with
very little more work this notation could actually do the expected thing!
Looks pretty "functional" to me!

[On the other hand, although this sort of data-pattern is just what a
programmer might like, I'm not sure that the folks who thought this
suggestion meant solving simultaneous recursive equations were way off
base.  Give that man a turing machine.  Complete with halting problem.]

-- JonL --