The version in the appended msg is wrong.
Correction version as follows:

spd=: 4 : 0
 ((1{f),*/0 2{f) $, 1 0 2|:(f=.x,c%x,1) $, (c=.d+(x|x-0{(d=. $y)),0){. y
)

spdj=: [: ,./ -@>.@(%~#) ]\ ]

   3 (spd -: spdj) i.7 4
1
   3 (spd -: spdj) i.23 4
1

The original APL version can be improved even
in APL.  For example,  x|x-y is equivalent to
x|-y .



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Sunday, February 18, 2007 1:12 pm
Subject: Re: [Jprogramming] Style and Literacy in APL

spdj=: [: ,./ [EMAIL PROTECTED] ]\ ]
 
  3 spdj i.7 4
0 1  2  3 12 13 14 15 24 25 26 27
4 5  6  7 16 17 18 19  0  0  0  0
8 9 10 11 20 21 22 23  0  0  0  0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to