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
;; simple | |
(define (fac acc n) | |
(if (= n 1) | |
acc | |
(fac (* acc n) (- n 1)))) | |
;; not | |
(define (fac n) | |
(if (= n 1) | |
1 |
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
x = 16 | |
puts case x.class | |
when String.class | |
"string" | |
when Fixnum.class | |
"fixnum" | |
else | |
"other" | |
end |
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
%%{ | |
machine lisp; | |
integer = '-'? . ('0'|[1-9][0-9]*); | |
string = '"' . (any - '"') . '"'; | |
list = '(' . (integer|string|list)* . ')'; | |
main := list; | |
}%% |
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
$ gcc moped.c -Wall -Wextra -ansi | |
$ ./a.out |
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
module 'module_name, as: [ | |
Greeter = object, as: [ | |
method 'hello_world, as: [ | |
"Hello world!" | |
] | |
method 'hello, as: [ some_word | | |
"Hello #{some_word}!" | |
] | |
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
module.alonzo.message [| | |
import [| alonzo.object ] | |
Message = Object.clone_as [| | |
slot_rw ['method_name, 'first_arg] | |
slot_r 'named_args | |
@named_args = {} | |
method 'mirror, as: [| |
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
$ cat test1.c | |
#include <stdio.h> | |
int main() { | |
int *a; | |
printf("addr:%d\n", (int)a); | |
return 0; | |
} | |
$ cat test2.c |
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
template<class T> struct Loop { Loop<T*> operator->(); }; | |
Loop<int> i, j = i->hooray; |
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
1.year + 2.months + 3.weeks # => 1 year, 2 months, and 21 days | |
2.hours + 30.minutes # => 9000 seconds |
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
config.grid_fs_host = Mongoid.config.master.connection.host |
OlderNewer