Much more elegant is:
chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ (<i.1 0),~ i.&.>x{.(-i.)y'
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens R.E. Boss
> Verzonden: zaterdag 2 augustus 2008 22:11
> Aan: 'Programming forum'
> Onderwerp: RE: [Jprogramming] Choosing k items out of n
>
> A minor improvement:
>
>
>
> chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ |. 0((,.&.>@{)`[`])} <@i."0
> (>:y-x)+i.x'
>
>
>
> to force a 2-cell for x=1 :
>
>
>
> 1 chs 3
>
> 0
>
> 1
>
> 2
>
> 2 chs 3
>
> 0 1
>
> 0 2
>
> 1 0
>
> 1 2
>
> 2 0
>
> 2 1
>
>
>
>
>
> R.E. Boss
>
>
>
>
>
> > -----Oorspronkelijk bericht-----
>
> > Van: [EMAIL PROTECTED] [mailto:programming-
>
> > [EMAIL PROTECTED] Namens Raul Miller
>
> > Verzonden: zaterdag 2 augustus 2008 17:06
>
> > Aan: Programming forum
>
> > Onderwerp: Re: [Jprogramming] Choosing k items out of n
>
> >
>
> > On Sat, Aug 2, 2008 at 1:49 AM, R.E. Boss <[EMAIL PROTECTED]> wrote:
>
> > > chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ |.<@i."0 (>:y-x)+i.x'
>
> >
>
> > That's beautiful.
>
> >
>
> > I hope you do not mind if I re-express this slightly:
>
> > cs=: ;@(,/@:(([ ,. <:+])"0 _)&.>/)@(i.&.>@{. [EMAIL PROTECTED])
>
> >
>
> > --
>
> > Raul
>
> > ----------------------------------------------------------------------
>
> > 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