bill lam wrote:
> btw anyone knows how to do it in C or have a pointer?  May be this serves as 
> an
> example of "C for J Programmers" :-)

The "C way of doing this" would involve a state machine.  Allocate the result 
array,
lay down a zero, update your state machine, lay down a 1, etc.
 
At each state update you increment one index and decrement the other.  If that 
would
take you off the edge, you bump the indices again* and reverse the sign of your
index delta.
 
*"Bump the indices again" means: Before the half way point: one of the indices 
has
gone below zero -- add one to it.    Once you've reached the half way point: 
one of
the indices has gone above its limit value, subtract one from it, and add two 
to the
other index.
 
-- 
Raul
 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to