Re: [sage-support] How to permute a list of elements in sage

2019-05-20 Thread jianrong
Thank you very much! -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support

Re: [sage-support] How to permute a list of elements in sage

2019-05-20 Thread slelievre
Simplifying the function and adding a docstring with an example: def f(i, v1): r""" Return a copy of this list with elements of index `i` and `i + 1` swapped. EXAMPLE:: sage: l = [5, 4, 3, 2, 1, 0] sage: f(3, l) [5, 4, 3, 1, 2, 0] """ v = list(v1)

Re: [sage-support] How to permute a list of elements in sage

2019-05-20 Thread Daniel Krenn
On 20.05.19 05:29, jianrong wrote: > I am trying to write a function in sage to permute a list of elements. An alternative might me something along the following: | Permutation("(1,2,3)(4,5)").action(['a', 'b', 'c', 'd', 'e']) | -- You received this message because you are subscribed to the Goo