(nct^:(i.5!28)31 )-: 5([([:|.@; [:(+&.><@;\.)/ */&(2^|[EMAIL
PROTECTED]))>:@-~)28
1
'(nct^:(i.5!28)31 )',:&ts '5([([:|.@; [:(+&.><@;\.)/
*/&(2^|[EMAIL PROTECTED]))>:@-~)28' NB. line wrap
0.59775966 8790272
0.004366199 3246144
However, what I do not understand:
ts'#: x'[x=. nct^:(i.5!28) 31
0.0050329073 4194880
ts'#: y'[y=. 5([([:|.@; [:(+&.><@;\.)/ */&(2^|[EMAIL PROTECTED]))>:@-~)28
3.137659 37881472
x-:&(;#:) y
1
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Jose Mario Quintana
> Verzonden: woensdag 29 augustus 2007 22:32
> Aan: 'Programming forum'
> Onderwerp: RE: [Jprogramming] Permutations of a sort.
>
>
> nct=. ((] or _2 c shift -~ <[EMAIL PROTECTED] ] xor [) ] + (] xor ] and ]
> - 1:)) f.
>
> nct
> (] 23 b. (_2"_) 33 b. -~ <[EMAIL PROTECTED] ] 22 b. [) (] + ] 22 b. ] 17 b. ]
> - 1:)
>
> ts'#: nc ^:(i.5!28) 31'
> 4.95167207 12984256
> ts'#: nct^:(i.5!28) 31'
> 1.87179656 12984256
>
> ((#: nct^:(i.5!28))-:(#: nct^:(i.5!28))) 31
> 1
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:programming-
> > [EMAIL PROTECTED] On Behalf Of Roger Hui
> > Sent: Tuesday, August 28, 2007 7:45 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Permutations of a sort.
> >
> > nc is a translation of the c code given by Andew Nikitin.
> > Its domain is machine-word (4-byte) integers. In the same
> > msg that contains the defn of nc there was an example:
> >
> > #: nc^:(i.3!5) 7
> >
> > Expanding the example:
> >
> > nc 7
> > 11
> > nc 11
> > 13
> > nc 13
> > 14
> > nc^:(i.3!5) 7
> > 7 11 13 14 19 21 22 25 26 28
> > #: nc^:(i.3!5) 7
> > 0 0 1 1 1
> > 0 1 0 1 1
> > 0 1 1 0 1
> > 0 1 1 1 0
> > 1 0 0 1 1
> > 1 0 1 0 1
> > 1 0 1 1 0
> > 1 1 0 0 1
> > 1 1 0 1 0
> > 1 1 1 0 0
> >
> >
> >
> > ----- Original Message -----
> > From: Ralph G Selfridge <[EMAIL PROTECTED]>
> > Date: Tuesday, August 28, 2007 15:50
> > Subject: Re: [Jprogramming] Permutations of a sort.
> > To: Programming forum <[email protected]>
> >
> > > I wrote this in as typed, if I use a binary string input I get
> > > rubbish.
> > > What am I mis-understanding? There is, for example, n and n-1.
> > > Doesn't this
> > > imply some integer to binary conversion (and back again)?
> > >
> > > Ralph
> > >
> > >
> > > On Tue, 28 Aug 2007, Roger Hui wrote:
> > >
> > > > and =: 17 b.
> > > > xor =: 22 b.
> > > > or =: 23 b.
> > > > shift=: 33 b.
> > > >
> > > > nc=: 3 : 0
> > > > n=. y
> > > > t=. n xor n and n-1
> > > > b=. t+n
> > > > b or _2 shift (b xor n) <[EMAIL PROTECTED] t
> > > > )
> > ----------------------------------------------------------------------
> > 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