ReadIntegerListsFromFile:=function(file) local l,f,i,a,r; f:=InputTextFile(file); a:=[]; while not IsEndOfStream(f) do l:=ReadLine(f); if l<>fail then l:=Chomp(l); # remove trailing CR/LF r:=[]; for i in SplitString(l," ,") do # separate by SPACE or , if Length(i)>0 then Add(r,Int(i)); fi; od; Add(a,r); fi; od; CloseStream(f); # <== New line return a; end; So easy to remember.... Lisette _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum
Gap is a very user friendly program. To read a file with integers, the only
thing you need is:
- [GAP Forum] How to read loops from 1 file. Aasma Shaheen
- Re: [GAP Forum] How to read loops from 1 file. Alexander Hulpke
- [GAP Forum] Correction: How to read loops from 1 ... Alexander Hulpke
- Re: [GAP Forum] Correction: How to read loops... Lisette Brillemans
- Re: [GAP Forum] Correction: How to read l... Alexander Konovalov
- Re: [GAP Forum] Correction: How to read l... Bill Allombert
- Re: [GAP Forum] Correction: How to re... Lisette Brillemans
- Re: [GAP Forum] Correction: How ... Aasma Shaheen
- Re: [GAP Forum] Correction: ... Bill Allombert
- Re: [GAP Forum] Correcti... Graham Gerrard
- Re: [GAP Forum] Correcti... Aasma Shaheen
- Re: [GAP Forum] Correcti... Igor Korepanov
- Re: [GAP Forum] Correcti... Alexander Konovalov
- Re: [GAP Forum] Correcti... Alexander Konovalov