Advertisement
Manhydra

C w/ Lambda

Aug 25th, 2014
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define valueOf(f, x) printf("Test: "#x" = %"#f"\n", x)
  5.  
  6. #define lambda(f,u,c,k) ({ f y u c y(k); })
  7.  
  8. int main(int arc, char **argv) {
  9.     int num = 3;
  10.  
  11.     num = lambda(int, (int a), {
  12.         return lambda(int, (int b), {
  13.             return b + lambda(int, (int c), {
  14.                 return c + 10;
  15.             }, b);
  16.         }, a);
  17.     }, num);
  18.  
  19.     lambda(void, (), { valueOf(d, num); }, NULL);
  20.  
  21.     exit(EXIT_SUCCESS);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement