The INVERSE operator in APL2.5
Vector 7:1, page 117
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 117
I was thrilled to see your review of IBM’s new APL2.5 in April’s Vector 6.4, and felt moved to send you a further couple of examples. One consequence of the direct definition of operators which may not be immediately obvious is the ease with which you can define the INVERSE operator for monadic functions:
INV produces a derived function which reverses the effect of its operand. Formally: A ↔ F INV F A for any array A and any monadic function F. The following examples show the power of this operator ...
Where the inverse is not unique, the system provides a ‘least squares’ solution:
and of course, INV may take a system function as operand, so:
⎕EX INV 1
FOO ⍝ re-instates a previously expunged function
2
⎕DL INV 2 ⍝ has the same effect as ⎕DL ¯2 in dyalog APL
We are only now beginning to appreciate the power of this new implementation, but I’m sure that such examples will soon swell our idiom libraries.
I. Phelfritt
c/o Dyadic Systems Ltd.