System Function CR: Difference between revisions
Line 100: | Line 100: | ||
</apll> | </apll> | ||
<p>When this was written, the existing magic functions were named <apll>#MonIota</apll>, <apll>#DydIota</apll>, <apll>#MonDnShoe</apll>, <apll>#DydTilde</apll>, <apll>#MonRank</apll>, <apll>#DydRank</apll>, <apll>#Conform</apll>, <apll>#MonFMT</apll>, <apll>#Box</apll>, and <apll>#MonVR</apll>. | <p>When this was written, the existing magic functions were named <apll>#MonIota</apll>, <apll>#DydIota</apll>, <apll>#MonDnShoe</apll>, <apll>#DydTilde</apll>, <apll>#MonRank</apll>, <apll>#DydRank</apll>, <apll>#Conform</apll>, <apll>#MonFMT</apll>, <apll>#Box</apll>, and <apll>#MonVR</apll>.<br/> | ||
<br/> | |||
{quad}CR is a system function, available in [[monadic]] and [[dyadic]] forms, which means you cannot assign a value to it. | |||
{{System Variables}} |
Revision as of 15:46, 27 February 2013
Monadic Function
|
||||
<apll>R</apll> is a character scalar or vector. | ||||
<apll>Z</apll> is a character matrix with as many rows as there are lines in the function (including the header), and as many columns as the longest line (including the header). |
This monadic function behaves the same as described in the Extended APL Standard, except it also displays the canonical representation of an assigned function or operator.
For example,
<apll> f←,∘⍋∘⍋∘,
⍴⎕←⎕cr 'f'
,∘⍋∘⍋∘,
1 7</apll>
If the assigned function references an unnamed value which is not a simple scalar, the representation shows a marker in that spot.
For example,
<apll>
f←'abcdefg'∘⎕cr
⎕cr 'f'
…∘⎕cr
</apll>
<apll>
f←⎕cr
⎕cr 'f'
f
f 'f'
f
</apll>
Dyadic Function
|
||||
<apll>R</apll> is a character scalar or vector. | ||||
<apll>L</apll> is an integer scalar whose value is either <apll>1</apll> or <apll>2</apll>. |
If the first character in <apll>R</apll> is <apll>#</apll>, then <apll>R</apll> is assumed to name an internal Magic Function; otherwise <apll>R</apll> is assumed to name a user-defined function/operator or a directly assigned function (e.g., <apll>f←+.×</apll>).
If <apll>L=2</apll>, then <apll>Z</apll> is a character matrix with as many rows as there are lines in the function (including the header), and as many columns as the longest line (including the header).
If <apll>L=1</apll>, then <apll>Z</apll> is either a simple character vector (for directly assigned functions), or a vector of character vectors (for user-defined functions/operators) with as many elements in <apll>Z</apll> as there are lines in the function (including the header), and each element of <apll>Z</apll> is a character vector representation of the corresponding line (or header) in the function.
For example,
<apll> f←+.×
⍴⎕←2 ⎕cr 'f'
+.×
1 3
⍴⎕←1 ⎕cr 'f'
+.×
3
2 ⎕cr '#MonIota'
Z←#MonIota R
Z←⊃∘.,/⍳¨R
1 ⎕cr '#MonIota'
Z←#MonIota R Z←⊃∘.,/⍳¨R
</apll>
When this was written, the existing magic functions were named <apll>#MonIota</apll>, <apll>#DydIota</apll>, <apll>#MonDnShoe</apll>, <apll>#DydTilde</apll>, <apll>#MonRank</apll>, <apll>#DydRank</apll>, <apll>#Conform</apll>, <apll>#MonFMT</apll>, <apll>#Box</apll>, and <apll>#MonVR</apll>.
{quad}CR is a system function, available in monadic and dyadic forms, which means you cannot assign a value to it.