Skip to content

Instantly share code, notes, and snippets.

@nvartolomei
Created November 27, 2011 18:39
Show Gist options
  • Save nvartolomei/1397951 to your computer and use it in GitHub Desktop.
Save nvartolomei/1397951 to your computer and use it in GitHub Desktop.
Functional C
#define lambda(return_type, function_body) \
({ \
return_type __fn__ function_body \
__fn__; \
})
// Use like this:
int (*max)(int, int) = lambda (int, (int x, int y) { return x > y ? x : y; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment