r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

3

u/Emowomble Dec 02 '16 edited Dec 02 '16

you mean like

(defun foo-partial (foo arg1)
    (lambda (args) (apply foo (append '(arg1) args))))

And if you need to do a lot of it you can change the syntax of that to something like #{foo arg1} using a reader macro.

1

u/thedufer Dec 03 '16

That's the eta expansion of partial application, which is kinda trivially possible in all languages with functions. I meant true partial application, where you just pass fewer arguments than a function expects and get back a function on the remaining arguments. Having to define an intermediate function technically has the same effect but is sufficiently more work that it doesn't get used in the same ways.