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

Reply via email to