System Function CR

From NARS2000
Revision as of 19:34, 25 March 2009 by WikiSysop (talk | contribs)
Jump to navigationJump to search

Monadic Function

Z←⎕CR R returns the canonical representation of the user-defined function or operator named in R.
R is a character scalar or vector.
Z 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,

      f←,∘⍋∘⍋∘,
      ⍴⎕←⎕cr 'f'
,∘⍋∘⍋∘,
1 7

If the assigned function references an unnamed value which is not a simple scalar, the representation shows a marker in that spot.

For example,

      f←'abcdefg'∘⎕cr
      ⎕cr 'f'
…∘⎕cr

      f←⎕cr
      ⎕cr 'f'
f
      f 'f'
f


Dyadic Function

Z←L ⎕CR R returns the canonical representation of the user-defined function or operator or magic function named in R.
R is a character scalar or vector.
L is an integer scalar whose value is one of ¯2, ¯1, 1, or 2.


If 2=|L, then Z 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 1=|L, then Z is a vector of character vectors with as many elements in Z as there are lines in the function (including the header), and each element of Z is a character vector representation of the corresponding line (or header) in the function.

If L>0, then R is assumed to name a user-defined function or operator.

If L<0, then R is assumed to name a magic function.

In both cases, the canonical representation of that function is returned, as per the above two rules.

For example,

      ¯2 ⎕cr '#MonIota'
Z←#MonIota R
Z←⊃∘.,/⍳¨R

When this was written, the existing magic functions were named #MonIota, #DydIota, #MonDnShoe, #DydTilde, #MonRank, #DydRank, #Conform, #MonFMT, and #Box.