PackRat wrote:
> Actually, I very deliberately had both a negative and
> positive example to see how to handle both cases.  The
> original code had the negative.  The reason behind this
> portion of my question was that I was wondering whether
> the negative axis-specifier meant (as in other APL commands) 
> working from the last dimension backward and how this would
> look in J.  My guess was that the _0.5th dimension might
> have been a new last or next-to-last dimension, but you
> didn't seem to address that question.  Is that the case,
> or what?  And, if so, how would it look in J?

I doubt the J programming forum is the right place to be
asking about the precise distinction  between the
APL fragments ,[-0.5] and ,[0.5].  So, I've taken the
liberty of responding using the general forum.

Personally, I'm not even sure I know the answer -- I've
not used APL since the last millennium.

If we are being precise, ,[-0.5] is probably like
,:"_1 and ,[0.5] is probably like ,:"1.  This assumes
that I've remembered my APL correctly, and assumes
quadIO is zero.

Note also that other, simpler expressions might also
be equivalent, depending on the problem domain.

A completely mechanical translation of APL to J would
likely involve a number of rather complicated expressions
which are designed to implement APL literally in J.  For
example, to emulate quadIO, you'd need a more complicated
expression than ,:"1, and most of the time you would be
far better off picking a J expression which was chosen
with knowledge of what quadIO value was intended for the
APL code.

Finally, if you don't know what the APL code does, you
might be better off writing the J code from first principles
(instead of trying to translate something you don't
understand).

-- 
Raul


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to