System Function CR: Difference between revisions

From NARS2000
Jump to navigationJump to search
(New page: ==Monadic Function== <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> ...)
 
No edit summary
Line 6: Line 6:
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <tr>
     <tr>
       <td valign="top"><apll>Z←{quad}CR R</apll></td>
       <td valign="top"><apll>Z←⎕CR R</apll></td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
Line 60: Line 60:
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <tr>
     <tr>
       <td valign="top"><apll>Z←L {quad}CR R</apll></td>
       <td valign="top"><apll>Z←L ⎕CR R</apll></td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
Line 91: Line 91:


<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¯2 ⎕cr '#MonIota'<br />
<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¯2 ⎕cr '#MonIota'<br />
Z←F R     <br />
Z←#MonIota R<br />
Z←⊃∘.,/⍳¨R<br />
Z←⊃∘.,/⍳¨R<br />
</apll>
</apll>


<p>When this was written, the existing magic functions were named <apll>#MonIota</apll>, <apll>#DydIota</apll>, <apll>#MonUpShoe</apll>, <apll>#DydTilde</apll>, <apll>#MonRank</apll>, <apll>#DydRank</apll>, and <apll>#Conform</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>, and <apll>#Box</apll>.

Revision as of 00:34, 26 March 2009

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.