RosettaCodeData/Task/Copy-a-string/GAP/copy-a-string.gap

14 lines
223 B
Text
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
#In GAP strings are lists of characters. An affectation simply copy references
a := "more";
b := a;
b{[1..4]} := "less";
a;
# "less"
# Here is a true copy
a := "more";
b := ShallowCopy(a);
b{[1..4]} := "less";
a;
# "more"