cmbnu=: 4 : ';(,.&.><@;\.)^:(<:x) ~ i.y'     NB. combinations with non
unique elements

   3 cmbnu 4
0 0 0
0 0 1
0 0 2
0 0 3
0 1 1
0 1 2
0 1 3
0 2 2
0 2 3
0 3 3
1 1 1
1 1 2
1 1 3
1 2 2
1 2 3
1 3 3
2 2 2
2 2 3
2 3 3
3 3 3

R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens R.E. Boss
> Verzonden: vrijdag 28 september 2007 18:50
> Aan: 'Programming forum'
> Onderwerp: RE: [Jprogramming] RE: Pairs revisited...
> 
> 
>    ;(](,.&.><@;\.)^:2]) i.4
> 0 0 0
> 0 0 1
> 0 0 2
> 0 0 3
> 0 1 1
> 0 1 2
> 0 1 3
> 0 2 2
> 0 2 3
> 0 3 3
> 1 1 1
> 1 1 2
> 1 1 3
> 1 2 2
> 1 2 3
> 1 3 3
> 2 2 2
> 2 2 3
> 2 3 3
> 3 3 3
> 
> 
> R.E. Boss
> 
> 
> > -----Oorspronkelijk bericht-----
> > Van: [EMAIL PROTECTED] [mailto:programming-
> > [EMAIL PROTECTED] Namens Paul Gauthier
> > Verzonden: vrijdag 28 september 2007 18:20
> > Aan: 'Programming forum'
> > Onderwerp: [Jprogramming] RE: Pairs revisited...
> >
> >
> > Roger Hui gave a non-unique pair algorithm as below:
> >
> > Roger Hui rhui000 at shaw.ca
> > Sat Feb 10 02:49:22 HKT 2007
> >
> > 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
> >
> > How would I go about having non-unique triplets, quadruplets etc.
> >
> >
> > ----------------------------------------------------------------------
> > 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

Reply via email to