This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#define REPL(expr) std::cout << "> " << #expr << std::endl << (expr) << std::endl | |
int main() | |
{ | |
int a = 1, b = 2; | |
REPL(a + b); | |
// print out: | |
// > a + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (y-combinator fn) | |
((lambda (func) | |
(func func)) | |
(lambda (f) | |
(fn (lambda args | |
(apply (f f) args)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "Hello, switch" | |
-- Suppose we want to write the equivalent lua code of the following c code: | |
-- switch (a) { | |
-- case 1: | |
-- printf("Case 1.\n"); | |
-- break; | |
-- case 2: | |
-- printf("Case 2.\n"); | |
-- break; |