Hi Gregg,

Thanks for your explanation. I do understand now the difference between 
copy and copy/deep. You only see the difference if you change something 
in a series and not when you completely replace a series inside a 
series. Thanks. Tim

Gregg Irwin wrote:

>Hi Tim,
>
>TH> Can someone give me an example of the diffrence between copy and copy/deep?
>TH> I  can't find any differences...
>
>The /deep refinement tells REBOL to make copies of all nested series,
>as well as the top level one.
>
>If we start with this:
>
>  
>
>>>a: [[1 2 3] [4 5 6]]
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>  
>
>>>b: copy a
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>  
>
>>>c: copy/deep a
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>
>There is no difference when we change the top level series
>
>  
>
>>>append c 'xxx
>>>      
>>>
>== [[1 2 3] [4 5 6] xxx]
>  
>
>>>a
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>  
>
>>>append b 'xxx
>>>      
>>>
>== [[1 2 3] [4 5 6] xxx]
>  
>
>>>a
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>
>Now, if we change a sub-series, you'll see that copy/deep prevented
>them from being changed in the original, while copy did not.
>
>  
>
>>>append c/1 'yyy
>>>      
>>>
>== [1 2 3 yyy]
>  
>
>>>a
>>>      
>>>
>== [[1 2 3] [4 5 6]]
>  
>
>>>append b/1 'yyy
>>>      
>>>
>== [1 2 3 yyy]
>  
>
>>>a
>>>      
>>>
>== [[1 2 3 yyy] [4 5 6]]
>
>-- Gregg                         
>
>  
>

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

Reply via email to