Skip to content

Instantly share code, notes, and snippets.

@b0oh
b0oh / gist:3931450
Created October 22, 2012 13:12
meta circular eval
(define (mceval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-assignment exp env))
((definition? exp) (eval-definition exp env))
((if? exp) (eval-if exp env))
((lambda? exp)
(make-procedure (lambda-parameters exp)
(lambda-body exp)
@b0oh
b0oh / gist:3617903
Created September 4, 2012 07:13
js s-expr pareser
String.prototype.fixSpaces = function () {
return this.replace(/\s+/g, ' ').trim();
};
var Symbol = String;
function tokenize(s) {
return s.replace(/([()])/g, ' $1 ').fixSpaces().split(' ');
};