I beg to differ. Take spdj. I copied it as given (I hope).
Now 5 spdj i.7 4 returns (for me)
0 1 2 3 8 9 10 11 16 17 18 19 24 25 26 27
4 5 6 7 12 13 14 15 20 21 22 23 0 0 0 0
Surely the correct answer is
0 1 2 3 8 9 10 11 16 17 18 19 24 25 26 27 0 0 0 0
4 5 6 7 12 13 14 15 20 21 22 23 0 0 0 0 0 0 0 0
In the original paper the width has to be multiplied by 5, and
if you copy their (bad) APL function that is what happens.
I have an APL function (might be like that in the paper, nice one-liner),
haven't tried to get it into J, mostly because I want to see if I goofed in
my copy of spdj
I also agree that figuring out what the function is meant to do is not the
easiest. I ended up direct copy of the (bad) function and trying it out.
Ralph S
On Sun, 18 Feb 2007, Roger Hui wrote:
Various translations going from most literal
to most J-like:
spdj=: [: ,./ -@>.@(%~#) ]\ ]
spd: literal translation of original APL
spd1: use better names and exploit features
available in some APLs (e.g. SHARP APL)
spd2: bypass having to deal with the # of columns
spd3: another way to bypass the # of columns
spd4: exploit ,./ and $
spdj: most J-like version
What I most dislike about the original APL version
is its lack of a good example. For example, from
3 spd > ;: 'able baker charlie dog echo fred gamma ham india jam ken lambda
michael'
able fred ken
baker gamma lambda
charlieham michael
dog india
echo jam
I would have known immediately what the function
was trying to achieve.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm