[GAP Forum] Confused about comparison functions

Alexander Hulpke ahulpke at gmail.com
Fri Nov 18 16:15:36 GMT 2011


Dear Forum, Dear Ms. Brillmanns,

On Nov 18, 2011, at 11/18/11 2:09, Lisette Brillemans wrote:
> 
> pair:=function(x,y); return[x,y]; end;
> 
> not ListX(Combinations(a,2),Combinations(a,2),\=,Pair)
> 
> which leads to: Variable: 'Pair' must have a value.

GAP is case sensitive, so clearly that won't work.

> So, \< isn't entirely "for nothing" because now "\<\>" doesn't work
> either. And using "not" isn't a solution for that. 
> 
> Or am I seeing this wrongly?

Yes, you are. There is no magic with prepending \ to comparison operators, but GAP just has two comparison operations: strictly smaller and equal. All other comparisons can be built from these two with logic operations. The identifier for the smaller operation is \< (since it looks rather natural; the \ is needed to make it a proper identifier versus the < binary operator). The identifier for equal is \=.

As so often, this is explained in the manual (look in the index under ``comparison''):
http://www.gap-system.org/Manuals/doc/htm/ref/CHAP030.htm#SSEC011.1

Other functions are not defined, though if you needed an (a>b) function, for example  you could simply define.
LargerComparison:=function(a,b) return a>b;end;

or you could even call it \>

Regards,

  Alexander Hulpke





More information about the Forum mailing list