• Array Notation

    From Phil Last@21:1/5 to All on Tue Sep 6 16:08:49 2022
    Dyalog Ltd. is likely soon to embark on the development of its own version of a far-reaching enhancement to APL notation.

    Referred to as "Array Notation" it's based initially on the simple premise that rather than engendering a SYNTAX ERROR, an opening bracket, "[" closed on a subsequent line or after a diamond, delimits a multi-line expression that denotes a multi-
    dimensional array wherein each expression defines a cell of that array:

    ⍴ num←[1 1 2 3
    5 8 3 1]
    2 4

    The principle is naturally recursive:

    ⍴ chr←[
    ['zero'
    'one']
    ['two'
    'three']
    ]
    2 2 5

    Over a number of years the idea was elaborated until Dyalog adopted it and continued to modify it after 2015.

    There is a couple of pages in the APL Wiki that attempt to describe it.

    It has been modelled in APL several times and has been implemented as a part of the language at least once.

    I'm sure Dyalog would be pleased to accept suggestions and comments in their forums to hone their design. I suggest the "Language" forum at https://forums.dyalog.com/viewforum.php?f=13 would be the place to start.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam Sirlin@21:1/5 to Phil Last on Sun Sep 11 12:31:11 2022
    I think it is a good idea to allow native array inputs. I'm not sure why overload [] rather than use normal (). I've done this for a while (2004) in my compiler. I like the fact that the input is the same as the output with this approach (for numbers and
    char strings).

    .rho #.is num .is ( 1 1 2 3
    5 8 3 1 )
    1 1 2 3
    5 8 3 1
    2 4

    .rho #.is array .is (
    1 1 2 3

    5 8 3 1 )
    1 1 2 3

    5 8 3 1
    2 1 4


    .rho #.is chr .is (
    <'zero'
    <'one'

    <'two'
    <'three')
    +-----+
    |zero |
    +-----+
    |one |
    +-----+

    +-----+
    |two |
    +-----+
    |three|
    +-----+
    2 2 1

    .rho #.is ca .is ('abc
    def')
    abc
    def
    7

    .rho #.is ca .is ('abc
    defgh')
    abc
    defgh
    9


    Sorry for the transliteration, still using ascii; # is quad

    Sam Sirlin

    On Tuesday, September 6, 2022 at 4:08:50 PM UTC-7, Phil Last wrote:
    Dyalog Ltd. is likely soon to embark on the development of its own version of a far-reaching enhancement to APL notation.

    Referred to as "Array Notation" it's based initially on the simple premise that rather than engendering a SYNTAX ERROR, an opening bracket, "[" closed on a subsequent line or after a diamond, delimits a multi-line expression that denotes a multi-
    dimensional array wherein each expression defines a cell of that array:

    ⍴ num←[1 1 2 3
    5 8 3 1]
    2 4

    The principle is naturally recursive:

    ⍴ chr←[
    ['zero'
    'one']
    ['two'
    'three']
    ]
    2 2 5

    Over a number of years the idea was elaborated until Dyalog adopted it and continued to modify it after 2015.

    There is a couple of pages in the APL Wiki that attempt to describe it.

    It has been modelled in APL several times and has been implemented as a part of the language at least once.

    I'm sure Dyalog would be pleased to accept suggestions and comments in their forums to hone their design. I suggest the "Language" forum at https://forums.dyalog.com/viewforum.php?f=13 would be the place to start.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil Last@21:1/5 to All on Wed Sep 14 01:17:25 2022
    If you look at the way Adam and I have implemented it in our different platforms - Link and Acre - we've both followed the direction we agreed back in 2016-17 that "broken" brackets and "broken" parentheses denote respectively increased rank and
    increased depth so your examples would create differently nested vectors rather than multi-dimentional arrays. A mix of the two can then form lists of matrices and matrices of lists in any combination.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil Last@21:1/5 to All on Wed Sep 14 01:48:25 2022
    " I like the fact that the input is the same as the output " was one of my two main incentives for all the effort.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)