[GAP Forum] File input

Joe Bohanon jbohanon2 at gmail.com
Tue Feb 3 04:28:39 GMT 2009


Sortex(<list>) will convert the list into the elements of S_n you want.

If you want to input a txt file, I would first open the file in a word
processor and turn it into a big list.  For instance, add "list:=[" to the
beginning, do a find-and-replace finding ] and replacing with ],.  Then go
to the end of the file, remove the extraneous comma and add "]:"

Then in GAP you do Read("file.txt"); (or put in the correct path if
necessary).  Then List(list,Sortex) will give you what you want.  If you
want a list without the commas, you can do, for instance:
list2:=List(list,Sortex);
for m in list2 do Print(m,"\n"); od;

Joe

On Mon, Feb 2, 2009 at 9:09 PM, Don King <symmetryholic at yahoo.ca> wrote:

> Hello,
>
> I am wondering if a file input is supported to convert a list of
> permutations into a list of cycles.
>
> For instance,
>
> I have an "a.txt" that includes
>
> [1,3,2,4]
> [2,4,1,3]
> ...........
>
> The output I'd like to get is  cycle formatted, such as
> (2,3)
> (1, 2, 4, 3)
> ....
>
> If the file input is not supported, what commands can be used to
> convert multiple permutations into cycles?
>
> Thanks in advance.
>
> Best regards,
> Don
>
>
>      __________________________________________________________________
> Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your
> favourite sites. Download it now at
> http://ca.toolbar.yahoo.com.
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>


More information about the Forum mailing list