Skip to content

Instantly share code, notes, and snippets.

@osa1
Created July 22, 2012 00:11
Show Gist options
  • Save osa1/3157641 to your computer and use it in GitHub Desktop.
Save osa1/3157641 to your computer and use it in GitHub Desktop.
debug
λ> (defun id (x) x)
applyCont DefineCont "id" EndCont env >>apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont EndCont env >>id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
<Function>
λ> (defun map (fun lst) (if (eq (list) lst) lst (cons (fun (first lst)) (map fun (rest lst)))))
applyCont DefineCont "map" EndCont env >>id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
<Function>
λ> (map id (list 1 2 3))
getVar "map"
applyCont ApplyCont [id,(1 2 3)] [] EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "id"
applyCont RemoveMeCont [(1 2 3)] [] <Function> EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont ApplyCont [(1 2 3)] [<Function>] EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont SeqCont [2,3] [] (RemoveMeCont [] [<Function>] <Function> EndCont) env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 1
applyCont SeqCont [3] [1] (RemoveMeCont [] [<Function>] <Function> EndCont) env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 2
applyCont SeqCont [] [1,2] (RemoveMeCont [] [<Function>] <Function> EndCont) env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 3
applyCont RemoveMeCont [] [<Function>] <Function> EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val [1,2,3]
applyCont ApplyCont [] [<Function>,[1,2,3]] EndCont env >>map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont SeqLastCont [((eq () lst),lst,(cons (fun (first lst)) (map fun (rest lst))))] EndCont env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val Nil
getVar "eq"
applyCont ApplyCont [(),lst] [] (PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont RemoveMeCont [lst] [] <Function> (PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val []
applyCont ApplyCont [lst] [[]] (PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "lst"
applyCont RemoveMeCont [] [[]] <Function> (PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val [1,2,3]
applyCont ApplyCont [] [[],[1,2,3]] (PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont PredCont lst (cons (fun (first lst)) (map fun (rest lst))) (SeqLastCont [] EndCont) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val False
getVar "cons"
applyCont ApplyCont [(fun (first lst)),(map fun (rest lst))] [] (SeqLastCont [] EndCont) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "fun"
applyCont ApplyCont [(first lst)] [] (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "first"
applyCont ApplyCont [lst] [] (RemoveMeCont [] [] <Function> (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont))) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "lst"
applyCont RemoveMeCont [] [] <Function> (RemoveMeCont [] [] <Function> (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont))) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val [1,2,3]
applyCont ApplyCont [] [[1,2,3]] (RemoveMeCont [] [] <Function> (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont))) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont RemoveMeCont [] [] <Function> (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 1
applyCont ApplyCont [] [1] (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont)) env >>fun, lst, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
applyCont SeqLastCont [x] (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont)) env >>x, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val Nil
getVar "x"
applyCont SeqLastCont [] (RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont)) env >>x, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 1
applyCont RemoveMeCont [(map fun (rest lst))] [] <Function> (SeqLastCont [] EndCont) env >>x, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val 1
applyCont ApplyCont [(map fun (rest lst))] [1] (SeqLastCont [] EndCont) env >>x, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "map"
applyCont ApplyCont [fun,(rest lst)] [] (RemoveMeCont [] [1] <Function> (SeqLastCont [] EndCont)) env >>x, map, id, apply, eval, first, rest, cons, eq, +, -, *, div, mod, quot, rem, =, <, >, /=, >=, <=, &&, ||, string?, symbol?, number?, list?, boolean?, symbol->string, type-of, println, read, make-application, nil<< val <Function>
getVar "fun"
Getting an unbound variable: fun
λ>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment