[GAP Forum] Tuple attribute
Jose Joao Morais
jjoao at netcabo.pt
Wed Dec 31 10:47:32 GMT 2003
Dear GAP Forum,
Thank you for your reply to my question about a Tuple attribute.
While I hadn't your answer, I implemented a new GAP object (Pair) which
is in `IsAttributeStoringRep', but I am having difficulties in defining
a method for the 'ONE' operation applicable to this new object.
gap> p:=Pair(Transformation( [ 1, 2, 3, 4 ] ), Transformation( [ 2, 3,
4, 4 ] ));
Pair(Transformation( [ 1, 2, 3, 4 ] ), Transformation( [ 2, 3, 4, 4 ] ))
gap> Monoid(p);
Error, no method found! For debugging hints type ?Recovery from
NoMethodFound
Error, no 2nd choice method found for `ONE' on 1 arguments called from
OneOp( elm ) called from
One( Representative( M ) ) called from
One( M ) called from
<compiled or corrupted call value> called from
<compiled or corrupted call value> called from
...
So, I defined this method:
InstallMethod( OneOp,
"for pairs",
true,
[ IsPair ], 0,
function( el )
return(Pair(One(el!.first), One(el!.second)));
end );
but I get the error:
Error, required filters [ "IsPair" ]
for 1st argument do not match a declaration of ONE called from
Looking then at the declaration of ONE I found:
basicim.gd:210:DeclareOperation( "ONE", [ IsBasicImageEltRep ] );
I have this definition for pairs:
BindGlobal( "PairsType", NewType( PairsFamily, IsPair and
IsExtAElement and IsNearAdditiveElement and IsAdditiveElement
and
IsNearAdditiveElementWithZero and IsAdditiveElementWithZero and
IsNearAdditiveElementWithInverse and
IsAdditiveElementWithInverse and
IsAdditivelyCommutativeElement and
CanEasilySortElements and CanEasilySortElements and
IsExtRElement and IsExtLElement and IsMultiplicativeElement and
IsMultiplicativeElementWithOne and
IsMultiplicativeElementWithZero and
IsMultiplicativeElementWithInverse and
IsAssociativeElement and
IsAttributeStoringRep ));
but if I add to these filters 'IsBasicImageEltRep', then, when I try to
define a pair I get an error:
gap> p:=Pair(Transformation( [ 1, 2, 3, 4 ] ), Transformation( [ 2, 3,
4, 4 ] ));
Record: '<rec>.Word' must have an assigned value at
return elt!.Word;
called from
Word( elt ) called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop ...
My question is: how can I define a Pair in such a way that it becomes
suitable for all the operations applicable to Tuples?
Thank you for your attention and patience,
Happy New Year,
Jose Morais
More information about the Forum
mailing list