[plt-scheme] Re: to define, or to let (last try)

From: Paul Schlie (schlie at comcast.net)
Date: Tue Apr 27 16:16:12 EDT 2004

Please, you've got to be kidding:

> This is incorrect.  When I see a fragment of code written thus:
> (foo (compute-a) (compute-b))
> Then I know that it is equivalent to this:
> (let ((arg2 (compute-b)))
>    (foo (compute-a) arg2))
> or vice versa.

- no, they're equally ambiguous if compute-a/b are interdependent.
  (so in truth, your presumed equivalence doesn't hold in R5RS)

> However were it written like this:
> (let* ((arg1 (compute-a))
>        (arg2 (compute-b)))
>    (foo arg1 arg2))
> I *know* that this:
> (let* ((arg2 (compute-b)))
>    (foo (compute-a) arg2))
> is a different program.

- yes, just as it would be a different program than:

  (foo (compute-a) (compute-b))

- which would be equivalent to (if evaluation order were fixed L->R):

  (let ((arg1 (compute-a))
        (arg2 (compute-b)))
     (foo arg1 arg2))

  which is actually a far more useful and unambiguous equivalence to have.

Posted on the users mailing list.