[GAP Forum] Bug in Add (list function)?
bsambale at gmx.de
Tue Sep 21 19:20:13 BST 2010
I forgot to copy my reply to the list:
Thank you very much! It works.
Am 21.09.2010 12:51, schrieb Mathieu Dutour:
> This is because when you add the element e, you actually add
> a pointer to it. Hence you change the value but the pointer
> does not change.
> The trick is to do
> Add(L, ShallowCopy(e));
> which really does the addition that you want.
>>> Dear GAP Forum,
>>> consider this small GAP code (I hope it is minimal somehow):
>>> for s in [,] do
>>> After that the list L should be [ [ 1 ], [ 0 ] ]. However GAP gives [ [
>>> 0 ], [ 0 ] ]. I'm not quite sure if this is a bug. It seems to me that
>>> the Add function only adds a pointer or something similar. Note that the
>>> code works as expected if one uses e:=1 and so on (without additional
>>> square brackets). By the way I'm using GAP 4.4.12.
>>> Thanks for clarification,
>>> Benjamin Sambale
>>> Forum mailing list
>>> Forum at mail.gap-system.org
> Forum mailing list
> Forum at mail.gap-system.org
More information about the Forum