let, let*, letrec, letrec*
(let ((var expr) ...) body1 body2 ...)
(letrec ((var expr) ...) body1 body2 ...)
Like let, the letrec syntactic form includes a set of variable-value pairs, along with a sequence of expressions referred to as the body of the letrec.
Unlike let, the variables var ... are visible not only within the body of the letrec but also within expr ....
With let, in contrast with let*, letrec, and letrec*, the expressions expr ... are all outside the scope of the variables var .... Also, in contrast with let* and letrec*, no ordering is implied for the evaluation of the expressions expr .... They may be evaluated from left to right, from right to left, or in any other order at the discretion of the implementation. Use let whenever the values are independent of the variables and the order of evaluation is unimportant.
(let* ((var expr) ...) body1 body2 ...)
let* is similar to let except that the expressions expr ... are evaluated in sequence from left to right, and each of these expressions is within the scope of the variables to the left. Use let* when there is a linear dependency among the values or when the order of evaluation is important.
(letrec ((var expr) ...) body1 body2 ...)
letrec is similar to let and let*, except that all of the expressions expr ... are within the scope of all of the variables var ....
(letrec* ((var expr) ...) body1 body2 ...)
letrec* is similar to letrec, except that letrec* evaluates expr ... in sequence from left to right. While programs must still not evaluate a reference to any var before the corresponding expr has been evaluated, references to var may be evaluated any time thereafter, including during the evaluation of the expr of any subsequent binding.