On Wed, 23 Jul 2014 08:59:24 -0400
David Joyner <wdjoy...@gmail.com> wrote:

> "first" I assume means first factor in the product, and similarly for "last".
> I don't know why they don't work. They should return the set
> associated to the first (resp., last) factor in the product.

The methods first and last give the first and last element of an
enumeration:

sage: A = FiniteEnumeratedSet(['a', 'b'])
sage: B = FiniteEnumeratedSet([0, 1, 2])
sage: C = cartesian_product([A, B])
sage: [x for x in C]
[('a', 0), ('a', 1), ('a', 2), ('b', 0), ('b', 1), ('b', 2)]
sage: C.first()
('a', 0)
sage: C.last()
('b', 2)

This probably comes up for a cartesian product of cyclic permutation
groups, because those are considered finite enumerated sets:

sage: G = CyclicPermutationGroup(4)
sage: G.categories()
[Category of finite permutation groups,
 Category of permutation groups,
 Category of finite groups,
 Category of finite monoids,
 Category of groups,
 Category of monoids,
 Category of finite semigroups,
 Category of semigroups,
 Category of inverse unital magmas,
 Category of unital magmas,
 Category of magmas,
 Category of finite enumerated sets,
 Category of enumerated sets,
 Category of finite sets,
 Category of sets,
 Category of sets with partial maps,
 Category of objects]
sage: [x for x in G]
[(), (1,2,3,4), (1,3)(2,4), (1,4,3,2)]
sage: G.first()
()
sage: G.last()
(1,4,3,2)


Regards,

Erik Massop

-- 
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