I did make mistakes.
R=:$ ,
and replace f with spd in the following usage examples.
2007/2/18, June Kim <[EMAIL PROTECTED]>:
After studying APL2 language reference for a while, it seems like
APL's rho(reshape) and J's shape($) has different behaviour.
R=:$@,
spd=: 4 : 0
X=.y
col=. x
((1{f),*/ 0 2{f ) R 1 0 2|:(f=.col,c%col,1)R(c=.d+(col|col-0{(d=.
$X)),0){. X
)
mat=.3 4 $'can you see '
2 f mat
can see
you
3 f mat
can you see
$2 f mat
2 8
$3 f mat
1 12
This works. Didn't I make any mistakes?
2007/2/18, June Kim <[EMAIL PROTECTED]>:
> Hello
>
> I've recently read an interesting article by Michael Berry and Roland
> Pesch. The title is Style and Literacy in APL.
>
> The whole point seems an APL code that's written with the style of
> each line being short(broken into pieces) isn't really helpful in
> improving the readability of the code, and actually it decreases the
> readability. Moreover, reading from left to right, the longer line
> style enables skimming and getting the whole picture easily.
>
> The author quotes some example codes from the literatures. One of them
> is from Standards for APL Applications Development and Enhancement, by
> Eugene R. Mannacio.
>
> SPD is a long line function and SPREAD is many lines composed of short
> ones, but both do the same thing.
>
> I don't know much about APL so it is hard for me to understand either
> of the functions. (the author's intention was showing SPD being easier
> to comprehend, though)
>
> spd=: 4 : 0
> X=.y
> col=. x
> ((1{f),*/ 0 2{f )$1 0 2|:(f=.col,c%col,1)$(c=.d+(col|col-0{(d=. $X)),0){.
X
> )
>
> This is my translation but obviously there was a few mis-translations,
> I suspect.
>
> There's a comment that describes what SPD does here: spreads a right
> argument matrix X of shape <M,N> to a result of shape
> <(T=.>.M%COLS),COLS*N>. Places first group of T rows in the first N
> columns and the next group of T rows in next N columns, etc.
>
> SPREAD also has its comment describing what it does(same thing with
> SPD): spreads a right argument matrix to a multiple of its current
> width. The multiple is specified by its left argument. Left arugment:
> the multiple desired (an integer). Right argument: the martix to be
> spread(usually character data). Result: the spread matrix.
>
> Now, could anyone help me translating the function spd into J(then I
> might easily translate SPREAD, too)?
>
> (I temporarily put the pdf file for the paper on my server. I might
> remove it in a couple of days. Get it from
> http://agcns.com/p1-berry.pdf )
>
> Thanks
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm