Partial function application: Difference between revisions
→{{header|TXR}}
m (→{{header|TXR}}) |
|||
Line 1,314:
<lang txr>[(op mapcar (op * 2)) '(1 2 3)]</lang>
We could define names for these functions like the problem statement says, but that defeats much of the point of partial application
<lang txr>(defun fsf1 (list)
[(op mapcar (op * 2))
Moreover, if we had a named function <code>f1</code> which does <code>(op * 2)</code> we would just dispense with that partial evaluation also and just write <code>[mapcar f1 list]</code>.
Here is an <code>op</code> expression that returns a function which squares the elements of a sequence, producing a new sequence. Since we use the multiplication function, we must repeat an argument and so we must use the <code>@number</code> syntax supported by <code>op</code>:
|