Skip to content

Instantly share code, notes, and snippets.

@a3f a3f/curry.c
Created Sep 7, 2015

Embed
What would you like to do?
#include <stdio.h>
typedef int (*two_var_func) (int, int);
typedef int (*one_var_func) (int);
int add_int (int a, int b) {
return a+b;
}
#define partial(f, a) ({ \
int g (int b) { \
return (f)((a),b); \
}\
g; \
})
int main (void) {
int a = 1;
int b = 2;
printf ("%d\n", add_int (a, b));
printf ("%d\n", partial(add_int, a) (b));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.