On 10 Jan., 12:04, javier <vengor...@gmail.com> wrote: > This is now Ticket #7890:http://trac.sagemath.org/sage_trac/ticket/7890 > > Thanks for volunteering to work on this, Dmitri! It would be awesome > to be able to access all that gap functions from sage. > Skimming a bit at the conversion code, it looks like the function > "sage" is called on the gap string representing the gap object.
Well, that's a default method, i.e., if nothing else is implemented than a conversion by strings is attempted, because there is some hope that the result makes sense. So, a proper way would be to override the default sage() method (from pexpect, or where is it defined?) for the gap interface. This new method would test the type of gap data (matrix; permutation group element; conjugacy class, ...) and do whatever needs to be done (return a sage matrix; return a permutation; return an instance of the new "conjugacy class" class, ...). Only if an unknown data type occurs, a string conversion would be attempted, as a last resort. If it fails, then nothing can be done. I don't know how to properly test the data type in gap. Would one use functions like IsPermGroup, IsMatrix? So, if IsMatrix is true for a gap object M, then the next step is to determine the underlying ring (dunno how). If R is that ring, then M.sage() would return a matrix over R.sage(). Best regards, Simon
-- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org