[GAP Forum] The command "IsIdentical" can not work.

Stefan Kohl stefan at mcs.st-and.ac.uk
Thu Dec 19 15:22:57 GMT 2013


On Thu, December 19, 2013 1:58 pm, Mathieu Dutour wrote:
> Well, the function "IsIdentical" simply does not exist.
> GAP is a functional language. The function themselves
> are variables.
>
> But if you want you have:
> gap> IsIdenticalObj(1,1);
> true
>
> or
> gap> 1=1;
> true
>
> I am not sure of the difference between both.

The difference between "=" and "IsIdenticalObj" is just the one between
"equal" and "the same", where "the same" is understood as "referring to the
same bytes in memory". -- For example:

gap> list1 := [1,2,3];;
gap> list2 := list1;;
gap> IsIdenticalObj(list1,list2);
true
gap> list1[2] := 17;
17
gap> list2; # changing list1 changed list2 as well, since it is THE SAME object
[ 1, 17, 3 ]
gap> list2 := ShallowCopy(list1); # make a copy, i.e. create another equal object
[ 1, 17, 3 ]
gap> list1 = list2; # list1 and list2 are still equal ...
true
gap> IsIdenticalObj(list1,list2); # ... but no longer identical
false
gap> list1[2] := 50; # now changing list1 does not change list2
50
gap> list2;
[ 1, 17, 3 ]

Hope this helps,

    Stefan Kohl

> On Thu, Dec 19, 2013 at 2:53 PM, Chiang-En Chen <l18981040 at gmail.com> wrote:
>
>> My GAP version is 4.6.5. When I performed the command   "IsIdentical( 1, 1
>> );" (this is an example in the section 27.10 of the manual ), it can not
>> work. The information of error is
>>
>> gap>  IsIdentical( 1, 1 );
>> Error, Variable: 'IsIdentical' must have a value
>> not in any function at line 1 of *stdin*
>>
>> Thank for reading.
>> _______________________________________________
>> Forum mailing list
>> Forum at mail.gap-system.org
>> http://mail.gap-system.org/mailman/listinfo/forum
>>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>




More information about the Forum mailing list