Hi there, > And another example, where I (would like to) follow the example of the > constructor for multivariate polynomials: > > sage: FreeGroup('x', 10) > Expected: > Free Group on the Set {x0, x1, x2, x3, x4, x5, x6, x7, x8, x9} > Got: > Free Group on the Set {x8, x9, x2, x3, x0, x1, x6, x7, x4, x5}
I think what is needed is the notion of what we call in combinatorics EnumeratedSets (see below). This is currently not the same think than sage EnumeratedSet class... With the integration of categories, I'm currently working on Sets... I'll shortly adapt sage Set to the category system and along the way put sage EnumeratedSet not in the category Sets but in the Category EnumeratedSets which is in my opinion what you need. Here is an excerpt of the doc: The category of enumerated sets An *enumerated set* is a *finite* or *countable* set or multiset `S` together with a canonical enumeration of its elements; conceptually, this is very similar to an immutable list. The main difference lies in the names and the return type of the methods, and of course the fact that the list of element is not supposed to be expanded in memory. Whenever possible one should use one of the two sub-categories :class:`FiniteEnumeratedSets` or :class:`InfiniteEnumeratedSets`. Of course this is still not in Sage but should (I'd rather say will :-) be in 4.3. Right now the only sage sets which are EnumeratedSets are Primes and the NonNegative Integers. Note That I have already a class FiniteEnumeratedSet which needs to be merged with sage EnumeratedSet: A class for finite enumerated set. Returns the finite enumerated set with elements in ``elements`` where ``element`` is any (finite) iterable object. The main purpose is to provide a variant of ``list`` or ``tuple``, which is a parent with an interface consistent with ``EnumeratedSets`` and has unique representation. The list of the elements is expanded in memory. There are some design questions which prevented me to do it at first. Let's start with the simple one: - on mathematical sets we have the notion of intersection, union, symmetric difference. When dealing with EnumeratedSets, does someone have any opinion on the order of enumeration of the result ? Or should the result be only in the category Sets ? Here is a much more complicated one: - If a parent is in a sub category of EnumeratedSets or Sets (say e.g.: FiniteGroup), Currently the forgetful functor is implemented by Set sage: S = Set(SymmetricGroup(3)) sage: S {(2,3), (1,3), (1,2), (1,3,2), (), (1,2,3)} Compare with: sage: list(SymmetricGroup(3)) [(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3)] sage: FiniteEnumeratedSet(SymmetricGroup(3)) {(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3)} But SymmetricGroup(3) is already in the category Sets sage: SymmetricGroup(3) in Sets() True So there should be no need to call explicitely the forgetful functor. In particular I don't see the point of creating another sage object for those case. Otherwise said, I only see the reason to create a new sage object for building a Set, when the object is not a sage Parent in the category Sets, eg: python list, set, frozenset ... Any comment or suggestion is mostly welcome. Cheers, Florent --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---