Hi Christian,

2014-05-28 11:32 UTC+02:00, Christian Stump <christian.st...@gmail.com>:
>> It seems that actually nobody read my initial post on that thread... so
>> let me repeat
>
> I did -- but didn't really have any qualified contribution...
>
>> But the semantic has to be implemented at the level of maps not at the
>> level of methods.
>
> could you explain what you mean there (maybe using your example of the
> number of descents of a permutation).

A method ( = a Python function) is not a Sage Map ( = a Python object
that model a mathematical function). I would like first to convert the
 method into a map
{{{
from sage.categories.map import Map
class NumberOfDescents(Map):
    def __init__(self):
        Map.__init__(Permutations(), NonNegativeIntegers())

    def _call_(self, p):
        return Integer(p.number_of_descents())
}}}
The above example is already non-trivial since it specifies a domain
and a codomain (which is different from the parent of the image of an
element):
{{{
sage: nod = NumberOfDescents()
sage: p = Permutation([3,2,1])
sage: nod(p)
3
sage: nod(p).parent() is NN
False
}}}
The second step would be to think how to add semantic to the map. Part
of is already managed by the axioms/categories (for example a Morphism
between GradedSets preserve the grading). But there is nothing for
injectivity/surjectivity or more subtle properties.

It would make more sense to register actual maps as above.

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to