Hi Carlos,

Tim already gave you the exact reasoning for what you're experiencing here,
you can examine it for yourself:

 >> loop 2 [append/only same: [] []]
== [[] []]

Not only are these blocks equal:

 >> equal? same/1 same/2
== true

They are the same blocks, indeed:

 >> same? same/1 same/2
== true

That's why

 >> append first same 1 same
== [[1] [1]]

Whereas with fresh copies of the empty block

 >> loop 2 [append/only equal: [] copy []]
== [[] []]
 >> equal? equal/1 equal/2
== true
 >> same? equal/1 equal/2
== false
 >> append first equal 1 equal
== [[1] []]

Cheers,
Christian





Tim Johnson schrieb:
> On Monday 27 April 2009, Carlos Lorenz wrote:
>  
>   
>> How come blk/2 and blk/3 were set to same value of blk/1 ???
>>     
>  Under the hood: they are the same 'pointer' - i.e. referencing
>  the same address in memory
>
> try 'array/initial - returns multiple memory references
>   
>>> blk: array/initial 3 []
>>>       
> == [[] [] []]
>   
>>> append blk/1 "1"
>>>       
> == ["1"]
>   
>>> blk
>>>       
> == [["1"] [] []]
>
> ;; HTH
> ;; tim
>   


-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to