This file contains hidden or 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
#!/opt/local/bin/gosh | |
(define (myeval exp env) | |
(cond ((atom? exp) | |
(if (number? exp) | |
exp | |
(assoc* exp env))) | |
((eq? (car exp) 'quote:) (cadr exp)) | |
(else (myapply (car exp) | |
(eval-args (cdr exp) env) env)))) |
This file contains hidden or 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
(setq indent-tabs-mode nil) | |
(setq load-path | |
(append | |
(list | |
(expand-file-name "~/emacssetup") | |
) | |
load-path)) | |
(require 'mac-key-mode) | |
(mac-key-mode 1) |
This file contains hidden or 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 foo | |
(lambda (n lst) | |
(if (zero? n) '() | |
(cons (cons n lst) (foo (- n 1) lst))))) | |
;; MIT Scheme | |
;; (foo 4 '(4)) | |
;; ==> ((4 4) (3 4) (2 4) (1 4)) | |
;; Gauche (and my env) |
This file contains hidden or 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> | |
#include <cstdlib> | |
using namespace std; | |
int data[5001]; | |
int main(){ | |
for (int i = 0; i < 5001; i++) data[i] = 0; | |
int buf; |
This file contains hidden or 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
-- Sxyz -> xz yz | |
-- Kxy -> x | |
-- Ix -> x | |
data Combinator = S | K | I | E | |
deriving (Show, Eq) | |
char2ski :: Char -> Combinator | |
char2ski c = case c of | |
'S' -> S |
This file contains hidden or 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
-- Sxyz -> xz yz | |
-- Kxy -> x | |
-- Ix -> x | |
data Combinator = S | K | I | E | |
deriving (Show, Eq) | |
char2ski :: Char -> Combinator | |
char2ski c = case c of | |
'S' -> S |
This file contains hidden or 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 sum | |
(lambda (lst) | |
(if (null? lst) | |
0 | |
(+ (car lst) (sum (cdr lst)))))) |
This file contains hidden or 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 node-expand | |
(lambda (n lst) | |
(if (zero? n) '() | |
(cons (cons n lst) (node-expand (- n 1) lst))))) | |
(define safe? | |
(lambda (lst) | |
(let ((new (car lst)) | |
(hlst (cdr lst))) | |
(if (null? hlst) #t |
This file contains hidden or 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
(setq indent-tabs-mode nil) | |
(setq load-path | |
(append | |
(list | |
(expand-file-name "~/emacssetup") | |
) | |
load-path)) | |
(require 'mac-key-mode) | |
(mac-key-mode 1) |
This file contains hidden or 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> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
int main(){ | |
srand((unsigned)time(NULL)); | |
char str[1024]; |
OlderNewer