[ prog / sol / mona ]

prog


Marvin Minsky - The Beauty of the Lisp Language

47 2020-10-07 00:37

(try implementing a macro on the level of loop in te C preprocessor)

#define sum(i,acc) acc+=i;
#define loop(x,y,func) ({int acc=0;for(int i=x;i<y;i++){func(i,acc);}acc;})
#define sumloop(x,y) loop(x,y,sum)
the above is (loop for i from 1 to 10 sum)

301


VIP:

do not edit these