{"id":7757,"date":"2023-04-21T12:09:53","date_gmt":"2023-04-21T12:09:53","guid":{"rendered":"https:\/\/www.dyalog.com\/blog\/?p=7757"},"modified":"2023-04-21T12:54:29","modified_gmt":"2023-04-21T12:54:29","slug":"formal-proposal-for-apl-array-notation-seeking-feedback","status":"publish","type":"post","link":"https:\/\/www.dyalog.com\/blog\/2023\/04\/formal-proposal-for-apl-array-notation-seeking-feedback\/","title":{"rendered":"Formal Proposal for APL Array Notation \u2013 Seeking Feedback"},"content":{"rendered":"<p>One of the defining features of the APL language is the ability to denote numeric vectors directly through juxtaposition \u2014 separating the elements by spaces, as in <code class=\"language-apl\">0 1 1 2 3 5 8<\/code>. The notation for character \u201cvectors\u201d is similar to that for \u201cstrings\u201d in most other languages, using quotes to denote the start and end of a list of characters. When generalised arrays were added to the language in the early 1980s, the most popular APL dialects extended the vector notation to allow nested arrays to be written using so-called <em>strand notation<\/em>, allowing the juxtaposition of sub\u2011expressions producing arrays to form a one-dimensional array \u2014 as in:<\/p>\n<pre><code class=\"language-apl\">      (2+2) (FOO 42) MAT<\/code><\/pre>\n<p>Strand notation works well for small, relatively simple one-dimensional arrays. As soon as arrays are too large to be represented on a single line of code, deeply nested, rank greater than one, or (in APL systems that support them) contain namespaces or objects, APL requires the use of primitives or system functions to assemble them from simple components.<\/p>\n<p>The flexibility of the APL language has allowed many APL programmers to work around the issue, either by implementing custom array notations or by using the ability of most APL interpreters to simply store arrays within saved workspaces without having an actual source form of the data. Within specific applications, domain specific notations can be very successful, but readability is poor for anyone not trained in the specific variation used \u2014 or who is missing the tooling required to interpret them \u2014 as well as sometimes having significant run-time cost.<\/p>\n<p>Recently, the need for a better notation for arrays has grown within the Dyalog APL community:<\/p>\n<ul>\n<li>The switch to text-based sources means that arrays that represent constants, enumerations or initial values \u2014 that arguably constitute part of the source of an application \u2014 need a textual representation if they are to be managed using the same tools as functions and operators.<\/li>\n<li>The increased use of namespaces and name\/value pairs as arguments to both user-defined and system functions makes the lack of a good notation for namespaces painful.<\/li>\n<\/ul>\n<p>Dyalog Ltd intends to implement core language support for a notation that makes it possible to write most arrays literally, without requiring the use of primitive functions, over multiple lines of source where this increases readability. It can be used to write nested arrays, and arrays of rank greater than one. The notation also describes many namespaces\/objects, providing both inline and anonymous definitions.<\/p>\n<h2 id=\"providing-feedback\">Acknowledgements<\/h2>\n<p>Although I used the word &#8220;recently&#8221; above, the foundations for the notation which gradually evolved into the proposal that we are publishing today were laid by Phil Last at <a href=\"https:\/\/www.dyalog.com\/user-meetings\/dyalog15.htm#U07\">Dyalog&#8217;15 in Sicily<\/a>. At Dyalog, Adam Brudzewsky has been the torch bearer and is the author of the current proposal. We would also like to recognise the contributions of Marshall Lochbaum and dzaima, who have acted as sounding boards and have implemented\u00a0notations similar to that proposed here in the APL-derivative BQN and in dzaima\/APL respectively.<\/p>\n<p style=\"text-align: center;\"><strong>Download <a href=\"https:\/\/abrudz.github.io\/aplan\/Formal%20Proposal%20%E2%80%94%20APL%20Array%20Notation.pdf\" target=\"_blank\" rel=\"noopener\">the full proposal document<\/a><br \/>\n<\/strong><\/p>\n<h2>Experimentation within Dyalog APL<\/h2>\n<p>Experimental implementations using APL models are available within some tools in the Dyalog eco-system, such as the Link tool (which supports the representation of code and data in Unicode text files) and the functions <code>Serialise<\/code> and <code>Deserialise<\/code> within the namespace <code>\u2395SE.Dyalog.Array<\/code>. You can also try it out in <a href=\"https:\/\/abrudz.github.io\/aplan\/\" target=\"_blank\" rel=\"noopener\">the interactive online sandbox<\/a>.<\/p>\n<h2 id=\"providing-feedback\">Providing feedback<\/h2>\n<p>Dyalog Ltd is keen to have feedback from the array language community on the notation proposed here, so that we can feel confident about the design before we proceed with our implementation. Our hope is that we will be able to keep the differences between future array notations within the family of array languages to a minimum.<\/p>\n<p>You can leave feedback below or in the APL Orchard chatroom, the APL Farm&#8217;s #apl channel, the r\/apl and r\/apljk subreddits, and the comp.lang.apl newsgroup, all of which we will monitor. (See <a href=\"https:\/\/aplwiki.com\/wiki\/Chat_rooms_and_forums\" target=\"_blank\" rel=\"noopener\">APL Wiki<\/a> for information about these forums.) In addition, we have created <a href=\"https:\/\/forums.dyalog.com\/viewtopic.php?f=13&amp;t=1871\" target=\"_blank\" rel=\"noopener\">a topic in our own forum<\/a>. If you prefer not to comment publicly, then please send comments <a href=\"mailto:arraynotation@dyalog.com\">by e-mail<\/a>. We will update <a href=\"https:\/\/aplwiki.com\/wiki\/Talk:Array_notation_design_considerations\" target=\"_blank\" rel=\"noopener\">the discussion page<\/a> for APL Wiki&#8217;s Array notation design considerations article to contain a record of significant feedback.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the defining features of the APL language is the ability to denote numeric vectors directly through juxtaposition \u2014 separating the elements by spaces, as in 0 1 1 2 3 5 8. The notation for character \u201cvectors\u201d is &hellip; <a href=\"https:\/\/www.dyalog.com\/blog\/2023\/04\/formal-proposal-for-apl-array-notation-seeking-feedback\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-7757","post","type-post","status-publish","format-standard","hentry","category-apl-language"],"_links":{"self":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/7757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/comments?post=7757"}],"version-history":[{"count":26,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/7757\/revisions"}],"predecessor-version":[{"id":7784,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/7757\/revisions\/7784"}],"wp:attachment":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/media?parent=7757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/categories?post=7757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/tags?post=7757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}