> < ^ From:

< ^ Subject:

Dear Catherine Greenhill,

Does anyone know what GAP does first when it reads the "*" symbol,

ie checking which domain the elements belong to, whether they

are records with an operations record containing a * function, etc.

I assume GAP does things like this but if anyone knows which order it

does them in, it would be very helpful.

---------------------------cut here ----------------------------------------- /**************************************************************************** ** *V HdCallProd . . . . . . . . . . . handle of the 'prod' function call bag ** ** 'ProdRec' returns the product of the two operands <hdL> and <hdR>, of ** which at least one must be a record. ** ** '<left> * <right>' ** ** The product of two records or an object and a record is defined as ** follows: ** ** If the right operand <right> is a record ** and is has a element with the name 'operations', which is a record, ** and this record has a element '*', which is a function, ** or if the left operand <left> is a record ** and is has a element with the name 'operations', which is a record, ** and this record has a element '*' which is a function, ** then this function is called with <left> and <right> as arguments ** and '<left> * <right>' is the value returned by this function. */ ---------------------------cut here -----------------------------------------

Example:

gap> r := rec( operations := rec( \* := function(x,y) Print("r\n"); end ) );; gap> l := rec( operations := rec( \* := function(x,y) Print("l\n"); end ) );; gap> 1 * r; r gap> r * 1; r gap> l * r; r gap> l * 1; l

best wishes

Frank

> < [top]