Hello, I do have a question linked to categorification of sage.combinat.words (trac #12224), Subwords (trac #10534) and graded sets (trac #10193).
For object like integer partition, compositions or words, it make sense to take slices. In the current implementation we do have quite different behavior for slices and parents {{{ sage: p = Partition([3,2,2,1]) sage: type(p[1:5]) <type 'list'> sage: p.parent() Partitions of the integer 8 sage: c = Composition([1,3,2,1,3]) sage: type(c[1:5]) <type 'list'> sage: c.parent() Compositions of non-negative integers sage: w = Word([1,3,3,1,2,1]) sage: type(w[1:5]) <class 'sage.combinat.words.word.FiniteWord_list'> sage: w.parent() Free monoid over {1, 2, 3} # this is the new implementation!! }}} Note that for partitions, slice with negative step is not defined. I would like that p[1:5] returns a partition and p[5:1:-1] returns an error (or a list). For such objects, it is possible to consider factors, subwords, shuffle product... but it is quite hard to have a common implementation for all of them (shuffle product needs to work for compositions and words). It would be nice to have a sort of protocol for sliceable elements in Sage in order to allow functorial construction as Subwords or ShuffleProduct. * Do we need that a slice like p[1:5] returns an object of the "same family" ? * Is it interesting to make "Subwords(Partition([3,2,1,1]))" work ? * What should be the default parent of Partition([3,2,1]), Composition([3,2,3,1]) or Word([1,2,1,2,3]) ? We have many choices. As an example, for Partition([3,2,1]) have four natural parents * partitions * partitions of 6 * partitions of length 3 * partitions of 6 of length 3 * Does slice make sense for other Sage objects ? Best, Vincent -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.