Jump to content

Partial function application: Difference between revisions

m
Line 1,296:
</pre>
 
=={{header|TXR}}==
 
The <code>f1</code> function is just <code>mapcar</code>, or at least the oft-used special case thereof when there is only one list to process and the function takes one argument.
Line 1,319:
[(op mapcar (op * 2)) '(1 2 3)]) ;; pointless: why don't we just call mapcar?</lang>
 
Here is an <code>op</code> expressinoexpression 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>:
 
<lang txr>(op mapcar (op * @1 @1))</lang>
543

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.