Array notation: Difference between revisions

Jump to navigation Jump to search
6 bytes added ,  02:27, 19 August 2022
m
list → vector
(→‎History: A+ and K versions (will do Dyalog tomorrow))
m (list → vector)
Line 1: Line 1:
'''Array notation''' is a way to write most [[array]]s literally, with no or minimal use of [[primitive function]]s, possibly over multiple code lines. It differs from the [[strand notation]] existing since [[APL\360]] in that it can be used to write arrays of rank greater than one. Array notation is supported in [[dzaima/APL]] and [[BQN]], and by some tools for [[Dyalog APL]], where it is planned as an eventual language feature.
'''Array notation''' is a way to write most [[array]]s literally, with no or minimal use of [[primitive function]]s, possibly over multiple code lines. It differs from the [[strand notation]] existing since [[APL\360]] in that it can be used to write arrays of rank greater than one. Array notation is supported in [[dzaima/APL]] and [[BQN]], and by some tools for [[Dyalog APL]], where it is planned as an eventual language feature.


Array notation generally consists of a list notation written with parentheses <source lang=apl inline>()</source>, roughly equivalent to stranding, and a high-rank notation using square brackets <source lang=apl inline>[]</source>, indicating the [[Mix]] of a list. It may also support [[namespace]]s, with dzaima/APL and Dyalog using <source lang=apl inline>name:value</source> syntax in parentheses for this. In each case, elements are separated by [[statement separator]]s such as <source lang=apl inline>⋄</source> or line breaks.
Array notation generally consists of a vector notation written with parentheses <source lang=apl inline>()</source>, roughly equivalent to stranding, and a high-rank notation using square brackets <source lang=apl inline>[]</source>, indicating the [[Mix]] of a vector. It may also support [[namespace]]s, with dzaima/APL and Dyalog using <source lang=apl inline>name:value</source> syntax in parentheses for this. In each case, elements are separated by [[statement separator]]s such as <source lang=apl inline>⋄</source> or line breaks.


== Examples ==
== Examples ==
Line 38: Line 38:
:''See also [[Array notation in Dyalog APL]]''
:''See also [[Array notation in Dyalog APL]]''


A predecessor of array notation is the list notation used by both [[A+]] and [[K]], with parenthesis-and-semicolon syntax like <source lang=apl inline>(a;b;c)</source>. In A+ this is related to [[bracket indexing]] and an "expression group" notation written with curly braces and semicolons. It allows line breaks, but in addition to rather than in place of semicolons. The later K version corresponds more closely to APL: the semicolon is a statement separator and is interchangeable with a line break, and because K represents arrays with nested lists, it corresponds to both list and high-rank array notation.
A predecessor of array notation is the list notation used by both [[A+]] and [[K]], with parenthesis-and-semicolon syntax like <source lang=apl inline>(a;b;c)</source>. In A+ this is related to [[bracket indexing]] and an "expression group" notation written with curly braces and semicolons. It allows line breaks, but in addition to rather than in place of semicolons. The later K version corresponds more closely to APL: the semicolon is a statement separator and is interchangeable with a line break, and because K represents arrays with nested lists, it corresponds to both vector and high-rank array notation.


== References ==
== References ==
<references/>
<references/>
{{APL syntax}}[[Category:APL syntax]][[Category:Nested array model]]
{{APL syntax}}[[Category:APL syntax]][[Category:Nested array model]]

Navigation menu