But in principle you only have to produce the numbers 0..2^(N-1) in binary form and filter (index) your set by the 1's (present), 0 absent..
In fact, if Martin needs to filter out some subsets, then filtering out integers and only generating subsets for the integers that remain, might even be faster.
groundset := [1,2,3,4] subset(li, n) == [x for x in li for i in 0..#li-1 | bit?(n, i)] sort((x,y)+->#x<#y or #x=#y and x<y,_ [subset(groundset, n) for n in 0..2^(#groundset)-1]) The question is whether sorting the subsets is needed. Ralf -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/4e8a608e-04c5-47e1-9755-94dfb9567cd3%40hemmecke.org.