Compose: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
No edit summary
Line 17: Line 17:


* The derived function from the form <apll><i>a</i>∘<i>b</i></apll> always signals a <apll>SYNTAX ERROR</apll>.
* The derived function from the form <apll><i>a</i>∘<i>b</i></apll> always signals a <apll>SYNTAX ERROR</apll>.
<p>
 
Compose can be useful for function assignment (but enclosing parentheses are necessary).
Compose can be useful for function assignment (but enclosing parentheses are necessary).
<br/>
 
For example<br/>
For example
<apll>
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p1←(1∘+¯2∘π) ⍝ 1 more than the Nth prime number<br/>
<apll><pre>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p1 ⍳9<br/>
      p1←(1∘+¯2∘π) ⍝ 1 more than the Nth prime number
      p1 ⍳9
3 4 6 8 12 14 18 20 24
3 4 6 8 12 14 18 20 24
</apll>
</pre></apll>

Revision as of 18:44, 15 April 2018

In the following descriptions, f and g represent functions and a and b represent variables.

  • The form fg may be used both monadically and dyadically.
Monadic: Z←fgR is identical to Z←fgR.
Dyadic: Z←LfgR is identical to Z←LfgR.
  • The form f∘b may be used monadically only.
Monadic: Z←(fb) R is identical to Z←R f b.
Note that parentheses are required around the function to avoid interpreting b R as a strand.
  • The form ag may be used monadically only.
Monadic: Z←agR is identical to Z←a g R.
  • The derived function from the form ab always signals a SYNTAX ERROR.

Compose can be useful for function assignment (but enclosing parentheses are necessary).

For example

      p1←(1∘+¯2∘π) ⍝ 1 more than the Nth prime number
      p1 ⍳9
3 4 6 8 12 14 18 20 24