Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Deepcopy/Aime/deepcopy.aime
Normal file
32
Task/Deepcopy/Aime/deepcopy.aime
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
list L1, L2;
|
||||
|
||||
# Lists are heterogeneous:
|
||||
l_append(L1, 3);
|
||||
l_append(L1, "deep");
|
||||
|
||||
# and may contain self references.
|
||||
# A self references in the last position:
|
||||
l_link(L1, -1, L1);
|
||||
|
||||
# List may also contain mutual references.
|
||||
# Create a new list in the last position:
|
||||
l_n_list(L1, -1);
|
||||
# Add a reference to the top level list to the nested list:
|
||||
l_link(l_q_list(L1, -1), -1, L1);
|
||||
|
||||
# There are no limitations to the deep copy method:
|
||||
l_copy(L2, L1);
|
||||
|
||||
# Modify the string in the original list,
|
||||
# via the self reference in the 3rd position
|
||||
l_r_text(l_q_list(L1, 2), 1, "copy");
|
||||
|
||||
# Show the string in the two lists:
|
||||
o_text(l_query(L2, 1));
|
||||
o_text(l_query(L1, 1));
|
||||
o_byte('\n');
|
||||
|
||||
# And again, via the included self references:
|
||||
o_text(l_query(l_query(L2, 2), 1));
|
||||
o_text(l_query(l_query(L1, 2), 1));
|
||||
o_byte('\n');
|
||||
Loading…
Add table
Add a link
Reference in a new issue