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

letrec and set!

It is written in R4RS section 4.2.2 that "One restriction on letrec is very
important: it must be possible to evaluate each <init> without ASSIGNING
or referring to the value of any <variable>. Why assigning is forbidden ?
It rules out some programs that are unambiguous such as:

(letrec ((x (begin (set! y 1)
                   y ))
         (y 3) )
  x )
              ---> 1

The value of y is not foreseeable but the result of x seems clear.