On 16 Jan 2014, at 20:03, "Wolstenholme, Robert" <robert.wolstenholm...@imperial.ac.uk> wrote:
> Is there a way in GAP to 'quickly' iterate of lists of lists i.e. like the > Python itertools.product() function? > Yes, see `21.20 Operations for Lists' from the GAP Reference Manual. You may enter `?Operations for Lists' in GAP or see it online at http://www.gap-system.org/Manuals/doc/ref/chap21.html#X7DF510F7848CBBFD A random example just to expose the syntax and some functions: gap> l:=List([1..10],i -> [1..i]); [ [ 1 ], [ 1, 2 ], [ 1 .. 3 ], [ 1 .. 4 ], [ 1 .. 5 ], [ 1 .. 6 ], [ 1 .. 7 ], [ 1 .. 8 ], [ 1 .. 9 ], [ 1 .. 10 ] ] gap> Sum( List( l, x -> Product( List( x, Fibonacci ) ) ) ); 124819000 HTH, Alexander _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum