GW4AAYNF7I66D72G5PMFTQRK7B4KZVYKAHKRPC2IY7IX37JKEHJQC lisp_eval_should_be '(quote unimplemented)' 'eh' 'nconc'
lisp_eval_should_be '(setq a (quote (1 2 3)))(setq b (quote (4 5)))(nconc a b)ab' '(1 2 3)(4 5)(1 2 3 4 5)(1 2 3 4 5)(4 5)' 'nconc'# the macro function returns the name of the macro; that's what the q# in the output islisp_eval_should_be '(macro q (lambda (x) (list (quote quote) (car x))))(q foo)' \'qfoo' 'macro'
function logg_dbg(where, x) { if(LOG_LEVEL >= 3) print "DBG " where ": " x >"/dev/stderr" }function logg_inf(where, x) { if(LOG_LEVEL >= 2) print "INF " where ": " x >"/dev/stderr" }function logg_err(where, x) { if(LOG_LEVEL >= 1) print "ERR " where ": " x >"/dev/stderr" }
function repeat_string(s, times, q, r, tmp) {if(times==0) return ""else if(times==1) return selse {q = int(times / 2)r = times % 2tmp = repeat_string(s, q)if(r) return (tmp tmp s)else return (tmp tmp)}}function sp(n) {return repeat_string(" ", n)}function binary_ticks(n, r, s) {s=""for(d=0; d < depth_binary_digits; d++) {r = n%2if(r) s = "'" selse s = " " sn = int(n/2)}if(n) return repeat_string("#", depth_binary_digits)else return s}
function represent_depth(d) {# memoizeif(d in depth_representations) {return depth_representations[d]} else {# ("[" binary_ticks(d) "]")return (depth_representations[d] = sp(d))}}function logg_dbg(where, x, d) {if(LOG_LEVEL >= 3)print "DBG" represent_depth(d) where ": " x >"/dev/stderr"}function logg_inf(where, x, d) {if(LOG_LEVEL >= 2)print "INF" represent_depth(d) where ": " x >"/dev/stderr"}function logg_err(where, x, d) {if(LOG_LEVEL >= 1)print "ERR" represent_depth(d) where ": " x >"/dev/stderr"}
logg_dbg("_evprog", "non-tail evaluating " _repr(_car(forms)))_eval3(_car(forms), env, env) # and throw away return value
logg_dbg("_evprog", "non-tail evaluating " _repr(_car(forms)), d)_eval3(_car(forms), env, env, d) # and throw away return value
logg_dbg("_evprog", "tail-eval-ing " _car(forms) " which contains "_repr(_car(forms)))return _eval3(_car(forms), env, outer_env)
logg_dbg("_evprog", "tail-eval-ing " _car(forms) " which contains "_repr(_car(forms)), d)return _eval3(_car(forms), env, outer_env, d)
tmp = _eval3(_caar(clauses), env, env) # the conditionlogg_dbg("_evcon", "thinking about clause " _repr(_car(clauses)) ". its condition works out to " _repr(tmp))
tmp = _eval3(_caar(clauses), env, env, d+1) # the conditionlogg_dbg("_evcon", "thinking about clause " _repr(_car(clauses)) ". its condition works out to " _repr(tmp), d)
acc = _cons(_symbol("list"),_cons(_cons(_symbol("list"),_cons(_cons(_symbol("quote"),_cons(_symbol("quote"),_nil())),_cons(_cdr(form),_nil()))),_nil()))logg_dbg("_expand macro call", "_evaling " _repr(acc))return _expand(_eval(acc))
logg_dbg("_expand macro call", "mpair is " _repr(mpair),depth+1)acc = _cons(_cadr(mpair),_cons(_cons(_cons(_symbol("quote"),_cons(_symbol("quote"),_nil())),_cons(_cdr(form),_nil())),_nil()),_nil())logg_dbg("_expand macro call", "_evaling " _repr(acc), depth)return _expand(_eval(acc, depth+1), depth+1)
function _eval3(form, env, outer_env, tv, t, v, n, cell, car, cdr, x, inner_env, a, b) {split(form, tv)t = tv[1]v = tv[2]logg_dbg("_eval3","form is " form " containing " _repr(form) "; env is " env " containing " _repr(env) "; outer_env is " outer_env " containing " _repr(outer_env))
function _eval3(form, env, outer_env, d, tv, t, v, n, cell, car, cdr, x, inner_env, a, b) {logg_dbg("_eval3","form is " form " containing " _repr(form) "; env is " env " containing " _repr(env) "; outer_env is " outer_env " containing " _repr(outer_env), d)
logg_dbg("_eval3 label", "env before: " env "; appending " _cadr(cell))inner_env = _bindseq(_cadr(form), env)logg_dbg("_eval3 label", "inner_env: " inner_env " containing " _repr(inner_env))return _evprog(_cddr(form), inner_env, inner_env)
logg_dbg("_eval3 label", "env before: " env "; appending " _cadr(cell), d)inner_env = _bindseq(_cadr(form), env, d+1)logg_dbg("_eval3 label", "inner_env: " inner_env " containing " _repr(inner_env), d)return _evprog(_cddr(form), inner_env, inner_env, d+1)
logg_dbg("_eval3", "evaluating list in function position: " _repr(car))return _eval3(_cons(_eval3(car, env), cdr), env)
logg_dbg("_eval3", "evaluating list in function position: " _repr(car), d)return _eval3(_cons(_eval3(car, env, d+1), cdr), env, env, d+1)