Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] copy versus copy/deep Re:

From: jelinem1:nationwide at: 28-Aug-2000 9:55

In order to see the difference, you have to change something in the "deep" data:
>> a: [ 1 2 [ 3 [ 4 5 ] 6 ] 7 8 ]
== [1 2 [3 [4 5] 6] 7 8]
>> b: copy a
== [1 2 [3 [4 5] 6] 7 8]
>> c: copy/deep a
== [1 2 [3 [4 5] 6] 7 8]
>> change a/3 9
== [[4 5] 6]
>> a
== [1 2 [9 [4 5] 6] 7 8]
>> b
== [1 2 [9 [4 5] 6] 7 8]
>> c
== [1 2 [3 [4 5] 6] 7 8] This shows that 'copy/deep did a true copy of the imbedded blocks, where 'copy did not. - Michael Jelinek [princepawn--lycos--com] on 08/28/2000 09:33:39 AM From: [princepawn--lycos--com] on 08/28/2000 09:33 AM Please respond to [list--rebol--com] To: [list--rebol--com] cc: Subject: [REBOL] copy versus copy/deep As my example below shows, there does not appear to a difference in handling nested blocks between copy and copy/deep
>> a: [ 1 2 [ 3 [ 4 5 ] 6 ] 7 8 ]
== [1 2 [3 [4 5] 6] 7 8]
>> b: copy a
== [1 2 [3 [4 5] 6] 7 8]
>> b
== [1 2 [3 [4 5] 6] 7 8]
>> c: copy/deep a
== [1 2 [3 [4 5] 6] 7 8]
>> c
== [1 2 [3 [4 5] 6] 7 8]
>> b
== [1 2 [3 [4 5] 6] 7 8]
>> a
== [1 2 [3 [4 5] 6] 7 8]