Thanks. I thought that using for. constructs incurred a time penalty, but the version without it is slower:
comb2 is also equivalent to comb , but requires space (and time) exponential in the size of the result. comb2=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) Why is this? On 28 Sep 2011, at 01:53, Henry Rich wrote: > http://www.jsoftware.com/jwiki/Essays/Combinations > > Henry Rich > > On 9/27/2011 8:50 PM, David Vaughan wrote: >> How could I list all combinations of x!y? >> >> e.g. 2!3 = 3, and the combinations are (1,2), (1,3), (2,3). >> >> Thanks. >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
