Consistent Extensions in NARS2000: Difference between revisions
From NARS2000
Jump to navigationJump to search
Sudleyplace (talk | contribs) (New page: * Strand Assignment: A sequence of names enclosed in parentheses can be assigned to, e.g. <apl size="large">(A B){is}1 2</apl> is the same as <apl size="large">A{is}1</apl> and <apl size=...) |
Sudleyplace (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
* Strand Assignment: A sequence of names enclosed in parentheses can be assigned to, e.g. <apl size="large">(A B){is}1 2</apl> is the same as <apl size="large">A{is}1</apl> and <apl size="large">B{is}2</apl>. | The following features are considered consistent extensions to the Extended APL Standard in that they replace error-producing behavior with non-error-producing behavior: | ||
* Modify Assignment: An arbitrary (primitive or user-defined) dyadic function may appear immediately to the left of an assignment arrow, e.g. <apl size="large">(A B) | |||
* Language Features | |||
** Sink: monadic <apl size="large">{is}</apl>, e.g. <apl size="large">{is}A</apl> to suppress the display of A. | |||
** Unified index reference, assignment, and modify assignment (<apl size="large">R[L]</apl>, <apl size="large">R[L]{is}A</apl>, and <apl size="large">R[L]</apl>'''''fn'''''<apl size="large">{is}A</apl>): these three forms all allow both Reach and Scatter indexing — that is, if <apl size="large">L{rightshoe}R</apl> is valid, it is equivalent to <apl size="large">{rightshoe}R[{leftshoe}L]</apl>, and if <apl size="large">L{squad}R</apl> is valid, it is equivalent to <apl size="large">R[{rightshoe}{jot}.,/L]</apl> — Reach and Scatter indexing may appear together within a single instance of <apl size="large">R[L]</apl>, <apl size="large">R[L]{is}A</apl>, and <apl size="large">R[L]</apl>'''''fn'''''<apl size="large">{is}A</apl>. | |||
** Dyadic operator jot (<apl size="large">∘</apl>) (composition) is used to join two functions or a function and a variable to produce a derived function (e.g., <apl size="large">f←,∘⍋∘⍋∘,</apl>) which is applied as a single function. For example, the function <apl size="large">f{is}*{jot}2</apl> when applied monadically, squares its argument. | |||
* Miscellaneous Syntax | |||
** Strand Assignment: A sequence of names enclosed in parentheses can be assigned to, e.g. <apl size="large">(A B){is}1 2</apl> is the same as <apl size="large">A{is}1</apl> and <apl size="large">B{is}2</apl>. | |||
** Modify Assignment: An arbitrary (primitive or user-defined) dyadic function may appear immediately to the left of an assignment arrow, e.g. <apl size="large">A</apl> '''''fn'''''<apl size="large">{is}1</apl> is the same as <apl size="large">A{is}A</apl> '''''fn''''' <apl size="large">1</apl>, and <apl size="large">A[L]</apl>'''''fn'''''<apl size="large">{is}1</apl> is the same as <apl size="large">A[L]{is}A[L]</apl> '''''fn''''' <apl size="large">1</apl>. | |||
** Modify Strand Assignment: An arbitrary (primitive or user-defined) dyadic function may appear immediately to the left of the assignment arrow used in Strand Assignment (e.g. <apl size="large">(A B)</apl>'''''fn'''''<apl size="large">{is}1 2</apl> is the same as <apl size="large">A{is}A</apl> '''''fn''''' <apl size="large">1</apl> and <apl size="large">B{is}B</apl> '''''fn''''' <apl size="large">2</apl>). | |||
** Function/operator assignment: A primitive function, operator, or derived function may be assigned to any available name (e.g., <apl size="large">F{is}+.{times}</apl>, or <apl size="large">F{is}{each}</apl>, or <apl size="large">F{is}{jot}</apl>). | |||
** Axis operator with primitive scalar dyadic functions: The axis operator indicates how the coordinates of the lower rank argument map to the coordinates of the higher rank argument. For example, <apl size="large">(1 2+[1] 2 3⍴R</apl> is equivalent to <apl size="large">({transpose}3 2{rho}1 2)+2 3⍴R</apl>. | |||
** Axis operator with primitive scalar dyadic functions may transpose coordinates: The order of the values in the axis operator brackets is significant. For example, <apl size="large">(2 3⍴L)+[1 2] 2 3 4⍴R</apl> and <apl size="large">(3 2⍴L)+[2 1] 2 3 4⍴R</apl> are both valid but, in general, have different values. | |||
** Axis operator with the dyadic derived function from the Each operator: As with primitive scalar dyadic functions, the axis operator indicates how the coordinates of the lower rank argument map to the coordinates of the higher rank argument. For example, <apl size="large">(2 3⍴L)⍴¨[1 2] 2 3 4⍴R</apl> is equivalent to <apl size="large">(3 1 2{transpose}4 2 3⍴L)⍴¨2 3 4⍴R</apl> (assuming <apl size="large">L</apl> has only six elements). | |||
** Axis operator to Ravel may transpose coordinates (e.g., ,[2 1] R and ,[1 2] R are both valid but, in general, have the same values in different order). | |||
* Session Manager | |||
** Function editor: this feature may be invoked by typing <apl size="large">{del}</apl> by itself, or <apl size="large">{del}</apl> followed by a name, or <apl size="large">)EDIT</apl> by itself, or <apl size="large">)EDIT</apl> followed by a name, or by double-right-clicking on a function name in the session manager or function editor windows. |
Revision as of 11:07, 22 March 2008
The following features are considered consistent extensions to the Extended APL Standard in that they replace error-producing behavior with non-error-producing behavior:
- Language Features
- Sink: monadic ←, e.g. ←A to suppress the display of A.
- Unified index reference, assignment, and modify assignment (R[L], R[L]←A, and R[L]fn←A): these three forms all allow both Reach and Scatter indexing — that is, if L⊃R is valid, it is equivalent to ⊃R[⊂L], and if L⌷R is valid, it is equivalent to R[⊃∘.,/L] — Reach and Scatter indexing may appear together within a single instance of R[L], R[L]←A, and R[L]fn←A.
- Dyadic operator jot (∘) (composition) is used to join two functions or a function and a variable to produce a derived function (e.g., f←,∘⍋∘⍋∘,) which is applied as a single function. For example, the function f←*∘2 when applied monadically, squares its argument.
- Miscellaneous Syntax
- Strand Assignment: A sequence of names enclosed in parentheses can be assigned to, e.g. (A B)←1 2 is the same as A←1 and B←2.
- Modify Assignment: An arbitrary (primitive or user-defined) dyadic function may appear immediately to the left of an assignment arrow, e.g. A fn←1 is the same as A←A fn 1, and A[L]fn←1 is the same as A[L]←A[L] fn 1.
- Modify Strand Assignment: An arbitrary (primitive or user-defined) dyadic function may appear immediately to the left of the assignment arrow used in Strand Assignment (e.g. (A B)fn←1 2 is the same as A←A fn 1 and B←B fn 2).
- Function/operator assignment: A primitive function, operator, or derived function may be assigned to any available name (e.g., F←+.×, or F←¨, or F←∘).
- Axis operator with primitive scalar dyadic functions: The axis operator indicates how the coordinates of the lower rank argument map to the coordinates of the higher rank argument. For example, (1 2+[1] 2 3⍴R is equivalent to (⍉3 2⍴1 2)+2 3⍴R.
- Axis operator with primitive scalar dyadic functions may transpose coordinates: The order of the values in the axis operator brackets is significant. For example, (2 3⍴L)+[1 2] 2 3 4⍴R and (3 2⍴L)+[2 1] 2 3 4⍴R are both valid but, in general, have different values.
- Axis operator with the dyadic derived function from the Each operator: As with primitive scalar dyadic functions, the axis operator indicates how the coordinates of the lower rank argument map to the coordinates of the higher rank argument. For example, (2 3⍴L)⍴¨[1 2] 2 3 4⍴R is equivalent to (3 1 2⍉4 2 3⍴L)⍴¨2 3 4⍴R (assuming L has only six elements).
- Axis operator to Ravel may transpose coordinates (e.g., ,[2 1] R and ,[1 2] R are both valid but, in general, have the same values in different order).
- Session Manager
- Function editor: this feature may be invoked by typing ∇ by itself, or ∇ followed by a name, or )EDIT by itself, or )EDIT followed by a name, or by double-right-clicking on a function name in the session manager or function editor windows.