[Jprogramming] Listing combinations
David Vaughan
purpleblues13 at googlemail.com
Wed Sep 28 09:00:51 HKT 2011
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
More information about the Programming
mailing list