Discussion:
[Bug-apl] Is the index generator function definition allowed to work on vectors of any length?
Leslie S Satenstein
2017-04-11 01:55:21 UTC
Permalink
Re Gnu APL. 1,7-1
Gnu apl processes     ⍳ 2    5
as  1 1  1 2  1 3  1 4  1 5
 2 1  2 2  2 3  2 4  2 5
and

⍳ 2    5    2
as 1 1 1  1 1 2
 1 2 1  1 2 2
 1 3 1  1 3 2
 1 4 1  1 4 2
 1 5 1  1 5 2

 2 1 1  2 1 2
 2 2 1  2 2 2
 2 3 1  2 3 2
 2 4 1  2 4 2
 2 5 1  2 5 2


Since when does interval (index generator) take more than a scaler, or a vector with rho greater than 1 ?
Where would this (above example) be used?

Its not described in APL2, or the iso document.  I am searching dyalog's documentation and it's not there either.
Is this an interpreter error or some undocumented extension?

 Regards
 Leslie
Leslie Satenstein
Montréal Québec, Canada
Elias Mårtenson
2017-04-11 04:05:13 UTC
Permalink
It's an extension. Since it's undefined by both APL2 as well as ISO 13751,
it's a compatible extension, and a quite useful one at that. For example,
creating a multiplication table is: ×/š⍳10 10, which also extends naturally
to more dimensions, unlike the alternative which uses ∘.×.

There was a discussion about this on this mailing list last year or so when
the extension was added. My understanding was that the extension was taken
from Dyalog, but you say it's not there, it must have been taking from
somewhere else. Perhaps it was from NARS2000?

Regards,
Elias
Post by Leslie S Satenstein
Re Gnu APL. 1,7-1
Gnu apl processes ⍳ 2 5
as
1 1 1 2 1 3 1 4 1 5
2 1 2 2 2 3 2 4 2 5
and
⍳ 2 5 2
as
1 1 1 1 1 2
1 2 1 1 2 2
1 3 1 1 3 2
1 4 1 1 4 2
1 5 1 1 5 2
2 1 1 2 1 2
2 2 1 2 2 2
2 3 1 2 3 2
2 4 1 2 4 2
2 5 1 2 5 2
Since when does interval (index generator) take more than a scaler, or a
vector with rho greater than 1 ?
Where would this (above example) be used?
Its not described in APL2, or the iso document. I am searching dyalog's
documentation and it's not there either.
Is this an interpreter error or some undocumented extension?
Regards
* Leslie*
*Leslie Satenstein*
*Montréal Québec, Canada*
Jay Foad
2017-04-11 08:12:04 UTC
Permalink
It's in Dyalog and NARS2000 documentation:

http://help.dyalog.com/15.0/Content/Language/Primitive%20Functions/Index%20Generator.htm
http://wiki.nars2000.org/index.php/Index_Generator
Post by Leslie S Satenstein
Re Gnu APL. 1,7-1
Gnu apl processes ⍳ 2 5
as
1 1 1 2 1 3 1 4 1 5
2 1 2 2 2 3 2 4 2 5
and
⍳ 2 5 2
as
1 1 1 1 1 2
1 2 1 1 2 2
1 3 1 1 3 2
1 4 1 1 4 2
1 5 1 1 5 2
2 1 1 2 1 2
2 2 1 2 2 2
2 3 1 2 3 2
2 4 1 2 4 2
2 5 1 2 5 2
Since when does interval (index generator) take more than a scaler, or a
vector with rho greater than 1 ?
Where would this (above example) be used?
Its not described in APL2, or the iso document. I am searching dyalog's
documentation and it's not there either.
Is this an interpreter error or some undocumented extension?
Regards
* Leslie*
*Leslie Satenstein*
*Montréal Québec, Canada*
Loading...