Strand notation: Difference between revisions

Jump to navigation Jump to search
23 bytes added ,  15:26, 13 November 2019
no edit summary
Miraheze>Adám Brudzewsky
m (Text replacement - "http://help.dyalog.com/latest/Content/Language/" to "http://help.dyalog.com/latest/index.htm#Language/")
Miraheze>Marshall
No edit summary
Line 1: Line 1:
Strand notation, or stranding, is the convention that multiple (more than one) arrays written next to each other are automatically combined into a [[vector]]. Stranding can make code easier to read by eliminating the need for punctuation when writing small arrays in APL. It can also cause frustration when programming if unrelated arrays are stranded together. This issue occurs when operators are allowed to take array operands, and can be resolved by inserting extra parentheses or identity functions into the expression.
'''Strand notation''', or '''stranding''', is the convention that multiple (more than one) arrays written next to each other are automatically combined into a [[vector]]. Stranding can make code easier to read by eliminating the need for punctuation when writing small arrays in APL. It can also cause frustration when programming if unrelated arrays are stranded together. This issue occurs when [[operator]]s are allowed to take array [[operand]]s, and can be resolved by inserting extra parentheses or [[identity function]]s into the expression.


Several variations on stranding exist:
Several variations on stranding exist:
* [[SHARP APL]] have no notion of array stranding.
* In [[APL2]] arrays are stranded before operator or function evaluation.
* In [[APL2]] arrays are stranded before operator or function evaluation.
* In some APLs (???) arrays are stranded after operator evaluation but before function evaluation.
* In [[APL*PLUS]] arrays are stranded after operator evaluation but before function evaluation.
* In [[J]] stranding is a part of token formation rather than execution. Only plain numbers are stranded.
* In [[SHARP APL]] and [[J]] stranding is called '''vector notation''' and is a part of token formation rather than execution. Only plain numbers are stranded.


An example in which stranding interferes with the most obvious way of writing a program is shown below. Consider applying the function <source lang=apl inline>f</source> to <source lang=apl inline>0.8</source> three times using the [[Power operator]]:
An example in which stranding interferes with the most obvious way of writing a program is shown below. Consider applying the function <source lang=apl inline>f</source> to <source lang=apl inline>0.8</source> three times using the [[Power operator]]:
Line 23: Line 22:


* [http://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Vector%20Notation.htm Dyalog]
* [http://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Vector%20Notation.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_010_130.htm APLX]
* [http://microapl.com/apl_help/ch_020_010_130.htm APLX]


{{APL programming language}}
{{APL programming language}}
Anonymous user

Navigation menu