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


    Date: Fri, 8 Apr 88 15:41:00 PDT
    From: James Rice <Rice@sumex-aim.stanford.edu>

    Yes, it's clear that in order to implement a letrec, which would allow
    you to express:

      (letrec ((circular (list 1 2 3 circular))

    Something would have to be fixed up after the structure was created.
    I have no idea how one would best implement this but I would assume
    that the compiler would substitute all all appropriate references to
    the named object with some sort of forwaring cell, which would be
    smashed to point to the whole object after it was created.

While that might work for simple data structure creation, there's just
no way it could be generalized.  What does:

(letrec ((value (+ value 3)))

mean?  Or how about?

(letrec ((circular (list* 1 2 3 (mapcar #'(lambda (x) (* x 2)) circular))))

return?  It looks like it should return something like
 (1  2  3
  2  4  6
  4  8 12
  8 16 24

but I don't think it is actually possible.