September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
6
Task/Deepcopy/Phix/deepcopy-1.phix
Normal file
6
Task/Deepcopy/Phix/deepcopy-1.phix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
object a, b
|
||||
a = {1,{2,3},"four",{5.6,7,{8.9}}}
|
||||
b = a
|
||||
b[3] = 4
|
||||
?a
|
||||
?b
|
||||
15
Task/Deepcopy/Phix/deepcopy-2.phix
Normal file
15
Task/Deepcopy/Phix/deepcopy-2.phix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
function deep_copy(object o)
|
||||
object res
|
||||
if atom(o) then
|
||||
res = o
|
||||
else
|
||||
res = repeat(' ',length(o))
|
||||
for i=1 to length(o) do
|
||||
res[i] = deep_copy(o[i])
|
||||
end for
|
||||
end if
|
||||
return res
|
||||
end function
|
||||
|
||||
object c = deep_copy(b)
|
||||
?c
|
||||
3
Task/Deepcopy/Phix/deepcopy-3.phix
Normal file
3
Task/Deepcopy/Phix/deepcopy-3.phix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
include builtins\serialize.e
|
||||
object d = deserialize(serialize(a))
|
||||
?d
|
||||
Loading…
Add table
Add a link
Reference in a new issue