Hey Simon,
   You might want to use FreeMonoid(index_set=S) as your basis indexing 
set. Although you will need 7.2.beta5 to do the iteration:

sage: S = (1,2)
sage: F = FreeMonoid(index_set=S)
sage: it = iter(F)
sage: [next(it) for _ in range(10)]
[1, F[1], F[2], F[1]*F[2], F[2]^2, F[1]^2, F[2]*F[1], F[1]^2*F[2], F[2]^2*F[
1], F[1]^3]
sage: [next(it).to_word_list() for _ in range(10)]
[[], [1], [2], [1, 2], [2, 2], [1, 1], [2, 1], [1, 1, 2], [2, 2, 1], [1, 1, 
1]]
sage: F([[1,4],[2,1],[1,1],[2,3]])
F[1]^4*F[2]*F[1]*F[2]^3

This works for any set S, but the iterator will only work for finite sets 
S. However, perhaps there could be some additional functionality for 
IndexedFreeMonoid that could be added to make it work with your use case.

Best,
Travis

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

Reply via email to