Hello PackRat;
I'll assume you would understand the fractional bracket index (it
inserts an axis) but cannot get around the negative. This is an
expression that makes sense where the index origin, or []IO is 0. When
the index origin is 1 you would use something between 0 and 1 to specify
inserting an axis before the first. Thus:
1 2 3,[0.5]4 5 6
1 2 3
4 5 6
i.e. a shape 2 3 value from shape3 3 values.
When the index origin is 0, the same sentence gives a different result:
1 2 3,[0.5] 4 5 6
1 4
2 5
3 6
which is like 1 2 3,[1.5]4 5 6
Note that ,. will give you what is being done in APL.
1 2 3 ,. 4 5 6
1 4
2 5
3 6
HTH.
PackRat wrote:
I wasn't sure which forum was the best for this kind of APL-to-J
programming question, so I thought I'd try it here. If that's not
correct, please let me know, so that I can submit any future questions
along this line to the appropriate forum.
I have a master's degree in music, and one of the main reasons behind
my learning J is to translate a published set of 66 computer-assisted
musical composition functions from APL to J. I'm pleasantly surprised
that my intense trying over the past several months to understand array
programming and J in particular seems to be paying off. Though by no
means being anywhere near very knowledgeable, I've been able to look at
both J and APL code and, in most cases, to understand what was going on
and, with APL code, to successfully begin translating to J versions.
(I've even been able to note on occasion that J had a better/shorter
way to do something than the APL code did.)
However, I ran into an APL construction that I cannot find in the half
dozen APL books I have. Since many/most of you have APL background, I
thought I ask here so that I could have some assistance in translating
to J. Here's the line that's stumped me (I substituted J's ~: for the
APL not-equal symbol and <- for APL's assignment symbol):
Z <- R,[_0.5](0 ~: ATTK)/ATTK <- +/[0] Z
I understand everything except the [_0.5] code and what it means in
context. It doesn't seem to fit anything in my books about bracketed
indexing in APL, and none of the book indexes lead to any information
about what this construction might mean, so that I can translate it to
J. Thanks in advance for any help!
Harvey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
------------------------------------------------------------------------
|\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ | | The only real problem with APL is that
BSc(Math) UNBF'83 | it is "still ahead of its time."
Sapere Aude | - Morten Kromberg
Natural Born APL'er |
-----------------------------------------------------(INTP)----{ gnat }-
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm