Date: Mon, 20 Oct 2008 18:30:09 -0700
From: Thomas Lord <[EMAIL PROTECTED]>
Cc: [email protected]
Alan Bawden wrote:
> I've deleted the message, but somebody wrote:
>
> Is this a valid program transformation?
>
> (apply = (append x y z))
>
> <==>
>
> (let ((x0 x)
> (y0 y)
> (z0 z))
> (let* ((xy (append x0 y0))
> (yz (append y0 z0)))
> (and (apply = xy)
> (apply = yz))))
>
> This is -not- a valid program transformation. Consider the case where
> y is the empty list.
It wasn't meant as a question of "what does R6 do".
Stop being so argumentative and think it through.
I presume we all agree that:
(= 1 1 2 2) ==> #F [1]
(= 1 1) ==> #T [2]
(= 2 2) ==> #T [3]
Now play along:
(apply = (append '(1 1) '() '(2 2)))
should be #F because of [1].
Following your transformation this becomes:
(let ((x0 '(1 1))
(y0 '())
(z0 '(2 2)))
(let* ((xy (append x0 y0))
(yz (append y0 z0)))
(and (apply = xy)
(apply = yz))))
which reduces to:
(and (apply = '(1 1))
(apply = '(2 2)))
which must be #T according to [2] and [3].
Note that `=' was not applied to less than two arguments anywhere in this
example.
I repeat: This is -not- a valid program transformation.
_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss