[REBOL] Re: reduce/deep
From: robert:muench:robertmuench at: 22-Oct-2003 20:17
On Tue, 21 Oct 2003 15:39:57 -0500, Joel Neely <[joel--neely--fedex--com]>
> Consider a simpler, analogous set of evaluations:
> >> a: b: "xyz" == "xyz"
> >> same? a b == true
> >> c: reduce [a b] == ["xyz" "xyz"]
> >> d: reduce [a b] == ["xyz" "xyz"]
> >> same? c/1 d/1 == true
> >> same? c/2 d/2 == true
> >> same? c d == false
> >> equal? c d == true
> or even *more* simpler (pardon the grammar! ;-)
> >> p: "12" == "12"
> >> q: "12" == "12"
> >> same? p/1 q/1 == true
> >> same? p/2 q/2 == true
> >> same? p q == false
> >> equal? p q == true
> These all illustrate the difference between SAME? and EQUAL? in that
> it is entirely possible to have two different series values whose
> corresponding elements are the same.
Hi, yes I got it now. Even I find this a tricky pitfall...
> In my first example above,
> as in your original post, two different REDUCE expressions over two
> different blocks will not produce THE SAME block, even if the content
> of those two blocks are the same. However the blocks are equal.
The problem I had(!) was that I thought that
reduce [a b c]
needs the [...] because I want to specify a list/block of values, more
like a syntactic need. That is has a semantic meaning as well (create new
block around those values) wasn't that obvious to me. I used 'reduce to
get back a block of values but, yes, it's a new block... Robert