Last line should have been,

   ((#: nct^:(i.5!28))-:(#: nc^:(i.5!28))) 31
1


----- Original Message ----
From: Jose Mario Quintana <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Wednesday, August 29, 2007 4:32:21 PM
Subject: 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

Reply via email to