Roger Hui posted the following synonymous phrases:
Combinations are usually defined to have unique elements. http://www.jsoftware.com/jwiki/Essays/Combinations However, if non-unique is what you want: f0=: (i. ([ ,. }.)&.> <@i.) f1=: (>:@i. @ - # i.) ,. ;@(}.&.> <)@i. f2=: ,~ #: (<:/~)@i. #&, i.@,~ f3=: (<:/"1 # ]) @ (,~ #: i.@*:)
The following all produce the same result:
; f0 4 f1 4 f2 4 f3 4
The output for all of the above is:
0 0 0 1 0 2 0 3 1 1 1 2 1 3 2 2 2 3 3 3
The beginning of the discussion thread in which these were posted is:
