Combinations are usually defined to have unique elements.
http://www.jsoftware.com/jwiki/Essays/Combinations
However, if non-unique is what you want:
; (i. ([ ,. }.)&.> <@i.) 4
0 0
0 1
0 2
0 3
1 1
1 2
1 3
2 2
2 3
3 3
----- Original Message -----
From: June Kim <[EMAIL PROTECTED]>
Date: Friday, February 9, 2007 9:11 am
Subject: Re: [Jprogramming] all pairs
> Thank you for interesting approaches, but those aren't what I was
> expecting.
> What I meant was "2 combination N"; compare the # of results of mine
> and yours. Sorry if my description wasn't clear.
>
> Following is one more approach I found:
> ut=:[: -. >/[EMAIL PROTECTED]
> ([: > ([:,@ut [EMAIL PROTECTED]) # [: ,@{ 2 $ < ) 'abcd'
> aa
> ab
> ac
> ad
> bb
> bc
> bd
> cc
> cd
> dd
>
>
> 2007/2/10, Miller, Raul D <[EMAIL PROTECTED]>:
> > Here's some other approaches:
> >
> > ,/ f"0/~ 'abcd'
> > f/&>,{;~ 'abcd'
> >
> > also (for boxed args):
> > f/&>,{,&<~ 'abcd'
> > f/&>,{(;<) 'abcd'
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm