Dual: Difference between revisions

From NARS2000
Jump to navigationJump to search
(Created page with "<table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> <td valign="top"><apll>Z←{L} <i>f</i>⍢<i>g</i> R</apll></td> <td></td> <td></td> <td>applies the function <apll><i>g</i></apll> then <apll><i>f</i></apll> and then <apll><i>g</i>⍣¯1</apll> to or between the arguments.</td> </tr> </table> </td> </tr> <tr> <td><apll>L</ap...")
 
No edit summary
 
Line 38: Line 38:


<apll><pre>
<apll><pre>
{⍺←⍣0 ⋄ ⍵⍵⍣¯1 (⍵⍵ ⍺)⍺⍺ ⍵⍵ ⍵}
{⍺←⍣0 ⋄ ⍵⍵⍣¯1 (⍵⍵ ⍺) ⍺⍺ ⍵⍵ ⍵}
</pre></apll>
</pre></apll>

Latest revision as of 01:09, 16 February 2024

Z←{L} fg R applies the function g then f and then g⍣¯1 to or between the arguments.
L is an optional array.
R is an array.
f is an arbitrary ambivalent function.
g is an arbitrary monadic function with an inverse.

Introduction

The concept of the Dual operator was described in Ken Iverson's paper on Operators and Functions.



Implementation

This operator is implemented via the anonymous function:

{⍺←⍣0 ⋄ ⍵⍵⍣¯1 (⍵⍵ ⍺) ⍺⍺ ⍵⍵ ⍵}