nested list



On 03/20/2013 01:45 PM, Stavros Macrakis wrote:
> xreduce('append, ...) will take [[a...],[b...]...] to [a...,b...,...].
Ah, that's what we needed; thanks, Stravos.

(%i1) ts: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]$

(%i2) xreduce('append,makelist(makelist(append 
(x,[y]),y,last(x)+1,5),x,ts));

(%o2) [[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3, 5], [1, 4, 5], 
[2, 3, 4], [2, 3, 5], [2, 4, 5], [3, 4, 5]]

Jaime