View the Era project on GitHub.
View the old Penknife project (Penknife Mk. I) on GitHub.
(nil) (yep (nil)) (cons (nil) (nil)) ((fn x (cons x x)) (nil) (nil)) ((fn x ((fn x (cons x x)) x x)) (nil) (nil)) (list quote.a quote.b) (defval qname.curried-example /fn x /fn y (cons y x)) ((curried-example (nil)) (yep/nil)) (let-list (a b) (list quote.foo quote.bar) a) (let-list (a b) (list quote.foo quote.bar) (list a a b b a)) (if (nil) quote.foo quote.bar) (if (yep/nil) quote.foo quote.bar) (let-list (a b) (list quote.foo quote.bar) (if (nil) (list a a b) (list b b a))) ( (fn args (let-list (a) args a)) (nil)) ( (fn-with-args (a b c) (list b b c)) quote.foo quote.bar quote.baz) (call-with-mbox-env/fn-with-args (mbox-env) /let my-mbox (mbox-new mbox-env (succ/nil)) /let a (mbox-get mbox-env my-mbox) /let - (mbox-set mbox-env my-mbox succ.a) /let b (mbox-get mbox-env my-mbox) /let - (mbox-set mbox-env my-mbox succ.b) /let c (mbox-get mbox-env my-mbox) /list a b c) (rev-append (list quote.a quote.b quote.c) (list)) (if-struct cons (first rest) (list quote.foo quote.bar quote.baz) (list first rest) (nil)) (take (succ/succ/nil) quote.(a b c)) ( (fn-with-varargs (a b c) rest (list a b c rest)) quote.a quote.b quote.c quote.d quote.e) (map (list (nil) (succ/nil) (succ/succ/nil)) succ) \= NOTE: These tests work, but they take a little too much time to \= execute. \= TODO: Speed 'em up. qq.(foo bar) qq.(foo uq.(succ/succ/nil)) qq.(foo uq.(succ/succ/nil) (uqs quote.(a b c))) qq.(foo (uq.(succ/succ/nil) (uqs quote.(a b c)) bar)) qq.(foo ((qq uq.(succ/succ/nil)) (qq (uqs quote.(a b c))) bar)) qq.(foo ((qq (uq uq.(succ/succ/nil))) (qq (uqs quote.(a b c))) bar)) (qq2/t/foo bar) (qq2/t/foo (qq2/x/x/succ/succ/nil)) (qq2/t/foo (qq2/x/x/succ/succ/nil) (qq2/x/s quote.(a b c))) (qq2/t/foo ((qq2/x/x/succ/succ/nil) (qq2/x/s quote.(a b c)) bar)) (qq2/t/foo ((qq2/t (qq2/x/x/succ/succ/nil)) (qq2/t (qq2/x/s quote.(a b c))) bar)) (qq2/t/foo ((qq2/t (qq2/x/x (qq2/x/x/succ/succ/nil))) (qq2/t (qq2/x/s quote.(a b c))) bar)) (qq2/t/foo ((qq2/t (qq2//x/x/succ/succ/nil)) (qq2/t (qq2/x/s quote.(a b c))) bar)) \= Test that we we don't let local names hijack the qualified names \= used by macro-generated code. (let append list qq.(a b c)) (let append list (qq2/t/a b c)) (defval qname.call-with-flow-grapher /fn-with-args (body) /call-with-mbox-env/fn-with-args (mbox-env) /call-with-local-linearity/fn-with-args (local-nonlinear-as-linear) /let mget (fn-with-args (mbox) (mbox-get mbox-env mbox)) /let mset (fn-with-args (mbox val) (mbox-set mbox-env mbox val)) /let rev-junctions-mbox (mbox-new mbox-env (nil)) /let next-node-num-mbox (mbox-new mbox-env (nil)) /let get-next-node-num (fn-with-args () /let result mget.next-node-num-mbox /let - (mset next-node-num-mbox (succ mget.next-node-num-mbox)) result) /let - (body/local-nonlinear-as-linear (get-next-node-num) \= Duplicating this value causes it to record a junction in the \= graph. (fn-with-args (inner-val num-dups) /let result (rev/fold-nat (nil) num-dups /fn-with-args (rev-result) (cons (get-next-node-num) rev-result)) /let - (mset rev-junctions-mbox (cons (list inner-val result) mget.rev-junctions-mbox)) result) \= Unwrapping this value is useless. (fn-with-args (inner-val) (nil))) (rev mget.rev-junctions-mbox)) \= Build a flow graph for some example code. (call-with-flow-grapher/fn-with-args (n) /let m (list n n) (list m m m))
Execute