diff options
author | David Robillard <d@drobilla.net> | 2012-12-23 05:31:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-12-23 05:31:15 +0000 |
commit | 67319bf0410196787c753225f46057bc7c94beec (patch) | |
tree | 572e8f8989a903fde8be784de5dddbaa1938ecfe | |
parent | 0375a20786f1e6eba9d128889f700b22d447021c (diff) | |
download | resp-67319bf0410196787c753225f46057bc7c94beec.tar.gz resp-67319bf0410196787c753225f46057bc7c94beec.tar.bz2 resp-67319bf0410196787c753225f46057bc7c94beec.zip |
Move towards standard Scheme syntax.
git-svn-id: http://svn.drobilla.net/resp/trunk@442 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r-- | src/compile.cpp | 2 | ||||
-rw-r--r-- | src/constrain.cpp | 6 | ||||
-rw-r--r-- | src/cps.cpp | 10 | ||||
-rw-r--r-- | src/depoly.cpp | 2 | ||||
-rw-r--r-- | src/expand.cpp | 8 | ||||
-rw-r--r-- | src/flatten.cpp | 16 | ||||
-rw-r--r-- | src/lift.cpp | 14 | ||||
-rw-r--r-- | src/pprint.cpp | 10 | ||||
-rw-r--r-- | src/repl.cpp | 4 | ||||
-rw-r--r-- | src/simplify.cpp | 8 | ||||
-rw-r--r-- | test/ack.scm (renamed from test/ack.resp) | 2 | ||||
-rw-r--r-- | test/closure.resp | 6 | ||||
-rw-r--r-- | test/closure.scm | 6 | ||||
-rw-r--r-- | test/def.resp | 8 | ||||
-rw-r--r-- | test/def.scm | 8 | ||||
-rw-r--r-- | test/deffn.resp | 3 | ||||
-rw-r--r-- | test/deffn.scm | 3 | ||||
-rw-r--r-- | test/fac.resp | 7 | ||||
-rw-r--r-- | test/fac.scm | 7 | ||||
-rw-r--r-- | test/inlinefn.resp | 1 | ||||
-rw-r--r-- | test/inlinefn.scm | 1 | ||||
-rw-r--r-- | test/let-over-fn.resp | 7 | ||||
-rw-r--r-- | test/let-over-fn.scm | 7 | ||||
-rw-r--r-- | test/let.scm (renamed from test/let.resp) | 2 | ||||
-rw-r--r-- | test/match.scm (renamed from test/match.resp) | 4 | ||||
-rw-r--r-- | test/nest.scm (renamed from test/nest.resp) | 4 | ||||
-rw-r--r-- | test/poly.scm (renamed from test/poly.resp) | 2 | ||||
-rw-r--r-- | test/quote.scm (renamed from test/quote.resp) | 4 | ||||
-rw-r--r-- | test/string.resp | 4 | ||||
-rw-r--r-- | test/string.scm | 4 | ||||
-rw-r--r-- | test/tup.scm (renamed from test/tup.resp) | 2 | ||||
-rw-r--r-- | wscript | 26 |
32 files changed, 99 insertions, 99 deletions
diff --git a/src/compile.cpp b/src/compile.cpp index 64dee08..69cce6d 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -230,7 +230,7 @@ resp_compile(CEnv& cenv, const AST* ast) throw() return compile_cons(cenv, call); else if (form == ".") return compile_dot(cenv, call); - else if (form == "def") + else if (form == "define") return compile_def(cenv, call); else if (form == "def-type") return compile_def_type(cenv, call); diff --git a/src/constrain.cpp b/src/constrain.cpp index e6e81a3..baa4ca8 100644 --- a/src/constrain.cpp +++ b/src/constrain.cpp @@ -173,7 +173,7 @@ constrain_fn(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error) for (++i; i != call->end(); ++i) { const AST* exp = *i; const ATuple* call = exp->to_tuple(); - if (call && is_form(call, "def")) { + if (call && is_form(call, "define")) { const ASymbol* sym = call->list_ref(1)->as_symbol(); THROW_IF(defs.count(sym) != 0, call->loc, (format("`%1%' defined twice") % sym->str()).str()); @@ -429,11 +429,11 @@ constrain_list(TEnv& tenv, Constraints& c, const ATuple* tup) throw(Error) constrain_cons(tenv, c, tup); else if (form == ".") constrain_dot(tenv, c, tup); - else if (form == "def") + else if (form == "define") constrain_def(tenv, c, tup); else if (form == "def-type") constrain_def_type(tenv, c, tup); - else if (form == "fn") + else if (form == "lambda") constrain_fn(tenv, c, tup); else if (form == "if") constrain_if(tenv, c, tup); diff --git a/src/cps.cpp b/src/cps.cpp index c55f728..bb375a8 100644 --- a/src/cps.cpp +++ b/src/cps.cpp @@ -63,7 +63,7 @@ cps_fn(CEnv& cenv, const ATuple* fn, const AST* cont) assert(fn->fst()); assert(copyProt.head); List copy; - copy.push_back(cenv.penv.sym("fn")); + copy.push_back(cenv.penv.sym("lambda")); copy.push_back(copyProt); for (ATuple::const_iterator i = fn->iter_at(2); i != fn->end(); ++i) @@ -105,7 +105,7 @@ cps_call(CEnv& cenv, const ATuple* call, const AST* k) std::vector<const AST*>::const_reverse_iterator a = args.rbegin(); for (ExpVec::const_reverse_iterator e = exprs.rbegin(); e != exprs.rend(); ++e, ++a) { if (!is_value(cenv, *e)) { - cont = resp_cps(cenv, *e, tup(Cursor(), cenv.penv.sym("fn"), + cont = resp_cps(cenv, *e, tup(Cursor(), cenv.penv.sym("lambda"), tup(Cursor(), *a, 0), cont, 0)); @@ -145,7 +145,7 @@ cps_if(CEnv& cenv, const ATuple* aif, const AST* k) } else { /* const ASymbol* const condSym = cenv.penv.gensym("c"); - const ATuple* contFn = tup(loc, tenv.penv.sym("fn"), + const ATuple* contFn = tup(loc, tenv.penv.sym("lambda"), tup(cond->loc, argSym, tenv.penv.gensym("_k"), 0), tup(loc, tenv.penv.sym("if"), argSym, exp->(tenv, cont), @@ -166,9 +166,9 @@ resp_cps(CEnv& cenv, const AST* ast, const AST* k) throw() if (call) { const ASymbol* const sym = call->fst()->to_symbol(); const std::string form = sym ? sym->sym() : ""; - if (form == "def") + if (form == "define") return cps_def(cenv, call, k); - else if (form == "fn") + else if (form == "lambda") return cps_fn(cenv, call, k); else if (form == "if") return cps_if(cenv, call, k); diff --git a/src/depoly.cpp b/src/depoly.cpp index c6de0c1..0ee89c1 100644 --- a/src/depoly.cpp +++ b/src/depoly.cpp @@ -112,7 +112,7 @@ resp_depoly(CEnv& cenv, Code& code, const AST* ast) throw() const ATuple* const call = ast->as_tuple(); const ASymbol* const sym = call->fst()->to_symbol(); const std::string form = sym ? sym->sym() : ""; - assert(form != "fn"); + assert(form != "lambda"); if (form == "quote") return ast; else if (form == "def-type") diff --git a/src/expand.cpp b/src/expand.cpp index b50d627..0cbe118 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -41,7 +41,7 @@ expand_fn(PEnv& penv, const AST* exp, void* arg) THROW_IF(++a == tup->end(), exp->loc, "Unexpected end of `fn' form"); THROW_IF(!(*a)->to_tuple(), (*a)->loc, "First argument of `fn' is not a list"); const ATuple* prot = (*a++)->to_tuple(); - List ret(new ATuple(penv.sym("fn"), NULL, exp->loc)); + List ret(new ATuple(penv.sym("lambda"), NULL, exp->loc)); ret.push_back(prot); while (a != tup->end()) ret.push_back(penv.expand(*a++)); @@ -67,7 +67,7 @@ expand_def(PEnv& penv, const AST* exp, void* arg) argsExp.head->loc = exp->loc; List fnExp; - fnExp.push_back(penv.sym("fn")); + fnExp.push_back(penv.sym("lambda")); fnExp.push_back(argsExp.head); for (++i; i != tup->end(); ++i) fnExp.push_back(*i); @@ -94,9 +94,9 @@ PEnv::expand(const AST* exp) THROW_IF(tup->empty(), exp->loc, "Call to empty list"); - if (is_form(tup, "def")) + if (is_form(tup, "define")) return expand_def(*this, exp, NULL); - else if (is_form(tup, "fn")) + else if (is_form(tup, "lambda")) return expand_fn(*this, exp, NULL); else return expand_list(*this, tup); diff --git a/src/flatten.cpp b/src/flatten.cpp index 424e5a6..ca849fa 100644 --- a/src/flatten.cpp +++ b/src/flatten.cpp @@ -32,7 +32,7 @@ flatten_def(CEnv& cenv, Code& code, const ATuple* def) throw() const ASymbol* const sym = def->list_ref(1)->as_symbol(); const AST* const body = def->list_ref(2); - if (!is_form(body, "fn")) { + if (!is_form(body, "lambda")) { code.push_back(def); return NULL; } @@ -89,7 +89,7 @@ flatten_do(CEnv& cenv, Code& code, const ATuple* ado) throw() code.push_back(ret); } const ASymbol* sym = cenv.penv.gensym("doval"); - List def(Cursor(), cenv.penv.sym("def"), sym, ret, NULL); + List def(Cursor(), cenv.penv.sym("define"), sym, ret, NULL); code.push_back(def); cenv.setTypeSameAs(sym, ado); return sym; @@ -103,7 +103,7 @@ flatten_if(CEnv& cenv, Code& code, const ATuple* aif) throw() cond = aif->frst()->as_symbol(); } else { cond = cenv.penv.gensym("ifcond"); - List def(Cursor(), cenv.penv.sym("def"), cond, + List def(Cursor(), cenv.penv.sym("define"), cond, resp_flatten(cenv, code, aif->frst()), 0); cenv.setTypeSameAs(cond, aif->frst()); code.push_back(def); @@ -131,7 +131,7 @@ flatten_if(CEnv& cenv, Code& code, const ATuple* aif) throw() code.push_back(else_goto); List end(Cursor(), cenv.penv.sym("if-end"), if_lab, NULL); - List def(Cursor(), cenv.penv.sym("def"), result, end.head, NULL); + List def(Cursor(), cenv.penv.sym("define"), result, end.head, NULL); code.push_back(def); cenv.setTypeSameAs(end, aif); @@ -150,7 +150,7 @@ flatten_call(CEnv& cenv, Code& code, const ATuple* call) throw() arg = flat_i; } else { const ASymbol* sym = cenv.penv.gensym(); - List def(Cursor(), cenv.penv.sym("def"), sym, flat_i, NULL); + List def(Cursor(), cenv.penv.sym("define"), sym, flat_i, NULL); code.push_back(def); arg = sym; cenv.setTypeSameAs(sym, *i); @@ -159,7 +159,7 @@ flatten_call(CEnv& cenv, Code& code, const ATuple* call) throw() copy.push_back(arg); } const ASymbol* sym = cenv.penv.gensym(); - List def(Cursor(), cenv.penv.sym("def"), sym, copy.head, NULL); + List def(Cursor(), cenv.penv.sym("define"), sym, copy.head, NULL); code.push_back(def); cenv.setTypeSameAs(copy, call); @@ -175,10 +175,10 @@ resp_flatten(CEnv& cenv, Code& code, const AST* ast) throw() const ATuple* const call = ast->as_tuple(); const ASymbol* const sym = call->fst()->to_symbol(); const std::string form = sym ? sym->sym() : ""; - assert(form != "fn"); + assert(form != "lambda"); if (form == "quote") return ast; - else if (form == "def") + else if (form == "define") return flatten_def(cenv, code, call); else if (form == "def-type") return flatten_def_type(cenv, code, call); diff --git a/src/lift.cpp b/src/lift.cpp index 7f236d1..7fa834f 100644 --- a/src/lift.cpp +++ b/src/lift.cpp @@ -76,7 +76,7 @@ lift_def(CEnv& cenv, Code& code, const ATuple* def) throw() const ASymbol* const sym = def->list_ref(1)->as_symbol(); const AST* const body = def->list_ref(2); cenv.def(sym, body, cenv.type(body), NULL); - if (is_form(body, "fn")) + if (is_form(body, "lambda")) cenv.setName(body->as_tuple(), sym->str()); assert(def->list_ref(1)->to_symbol()); @@ -126,7 +126,7 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() for (ATuple::const_iterator p = fn->prot()->begin(); p != fn->prot()->end(); ++p) { const AST* paramType = (*tp++); - if (is_form(paramType, "Fn")) { + if (is_form(paramType, "lambda")) { const ATuple* fnType = new ATuple(cenv.tenv.var(), paramType->as_tuple(), paramType->loc); paramType = tup((*p)->loc, cenv.tenv.Tup, fnType, NULL); } @@ -136,7 +136,7 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() } // Write function prototype first for mutual and/or nested recursion - List declProt(fn->loc, cenv.penv.sym("fn"), 0); + List declProt(fn->loc, cenv.penv.sym("lambda"), 0); declProt.push_back(implProt); List decl(fn->loc, cenv.penv.sym("prot"), cenv.penv.sym(implNameStr), 0); decl.push_back(declProt); @@ -157,7 +157,7 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() // Create definition for implementation fn const ASymbol* implName = cenv.penv.sym(implNameStr); - const ATuple* def = tup(fn->loc, cenv.penv.sym("def"), implName, impl.head, NULL); + const ATuple* def = tup(fn->loc, cenv.penv.sym("define"), implName, impl.head, NULL); // Define types before lifting body with return type as a variable List implT(Cursor(), type->fst(), implProtT.head, retTVar, 0); @@ -244,7 +244,7 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw() copy.push_front(cenv.penv.sym(cenv.liftStack.top().implName)); copy.push_front(cenv.penv.sym("call")); cenv.setTypeSameAs(copy, call); - } else if (is_form(call->fst(), "fn")) { + } else if (is_form(call->fst(), "lambda")) { /* Special case: ((fn ...) ...) * Lifting (fn ...) yields: (Closure _impl ...). * We don't want (call (. (Closure _impl ...) 1) (Closure _impl ...) ...), @@ -307,13 +307,13 @@ resp_lift(CEnv& cenv, Code& code, const AST* ast) throw() return lift_args(cenv, code, call); else if (form == ".") return lift_dot(cenv, code, call); - else if (form == "def") + else if (form == "define") return lift_def(cenv, code, call); else if (form == "def-type") return call; else if (form == "do") return lift_args(cenv, code, call); - else if (form == "fn") + else if (form == "lambda") return lift_fn(cenv, code, call); else if (form == "if") return lift_args(cenv, code, call); diff --git a/src/pprint.cpp b/src/pprint.cpp index bbb4904..ff19331 100644 --- a/src/pprint.cpp +++ b/src/pprint.cpp @@ -37,7 +37,7 @@ newline(ostream& out, unsigned indent) static inline void print_annotation(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool print) { - if (is_form(ast, "def")) + if (is_form(ast, "define")) return; if (print) { @@ -143,8 +143,8 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types) out << " "; } - if (form == "def") { - if (tup->rrst() && is_form(tup->frrst(), "fn")) { + if (form == "define") { + if (tup->rrst() && is_form(tup->frrst(), "lambda")) { // Abreviate (def (fn (...) ...)) out << "(" << (*i++) << " "; const ATuple* const fn = tup->frrst()->as_tuple(); @@ -179,7 +179,7 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types) newline(out, indent + 2); print_list(out, tup, i, indent + 2, cenv, types, false); - } else if (form == "fn") { + } else if (form == "lambda") { // Print prototype (possibly with parameter type annotations) const ATuple* pat = (*i++)->as_tuple(); out << "("; @@ -266,7 +266,7 @@ pprint(ostream& out, const AST* ast, CEnv* cenv, bool types) print_to(out, ast, 0, cenv, types); print_annotation(out, ast, 0, cenv, types); out << endl; - if ((is_form(ast, "def") && is_form(ast->as_tuple()->frrst(), "fn")) + if ((is_form(ast, "define") && is_form(ast->as_tuple()->frrst(), "lambda")) || is_form(ast, "fn-end") || is_form(ast, "def-type")) out << endl; diff --git a/src/repl.cpp b/src/repl.cpp index 25da08a..9709656 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -134,7 +134,7 @@ compile(CEnv& cenv, const Code& parsed, Code& defs, bool& hasMain, const char* m for (Code::const_iterator i = stages.back().begin(); i != stages.back().end(); ++i) { const ATuple* call = (*i)->to_tuple(); if (call && (is_form(*i, "def-type") - || (is_form(*i, "def") && is_form(call->frrst(), "fn")))) { + || (is_form(*i, "define") && is_form(call->frrst(), "lambda")))) { resp_flatten(cenv, defs, call); } else if (call && is_form(*i, "prot")) { defs.push_back(*i); @@ -151,7 +151,7 @@ compile(CEnv& cenv, const Code& parsed, Code& defs, bool& hasMain, const char* m if (!exprs.empty()) { const ASymbol* main = cenv.penv.sym(mainName); - List mainT(Cursor(), cenv.penv.sym("Fn"), new ATuple(Cursor()), retT, NULL); + List mainT(Cursor(), cenv.penv.sym("lambda"), new ATuple(Cursor()), retT, NULL); cenv.def(main, NULL, mainT, NULL); defs.push_back( diff --git a/src/simplify.cpp b/src/simplify.cpp index d8d23f2..f1b1bec 100644 --- a/src/simplify.cpp +++ b/src/simplify.cpp @@ -65,7 +65,7 @@ simplify_match(CEnv& cenv, Code& code, const ATuple* match) throw() const ASymbol* tsym = cenv.penv.gensym("__tag"); - List def(match->loc, cenv.penv.sym("def"), tsym, tval.head, NULL); + List def(match->loc, cenv.penv.sym("define"), tsym, tval.head, NULL); cenv.setType(tval.head, cenv.tenv.named("Symbol")); List copyIf; @@ -98,13 +98,13 @@ simplify_match(CEnv& cenv, Code& code, const ATuple* match) throw() const ATuple* prot = new ATuple(osym, 0, Cursor()); const ATuple* protT = new ATuple(texp, 0, Cursor()); - List fn(Cursor(), cenv.penv.sym("fn"), prot, 0); + List fn(Cursor(), cenv.penv.sym("lambda"), prot, 0); int idx = 0; ATuple::const_iterator ti = texp->iter_at(1); for (ATuple::const_iterator j = pat->iter_at(1); j != pat->end(); ++j, ++ti, ++idx) { const AST* index = new ALiteral<int32_t>(T_INT32, idx, Cursor()); const AST* dot = tup(Cursor(), cenv.penv.sym("."), osym, index, 0); - const AST* def = tup(Cursor(), cenv.penv.sym("def"), *j, dot, 0); + const AST* def = tup(Cursor(), cenv.penv.sym("define"), *j, dot, 0); fn.push_back(def); } @@ -144,7 +144,7 @@ simplify_let(CEnv& cenv, Code& code, const ATuple* call) throw() { const ATuple* vars = call->list_ref(1)->to_tuple(); - List fn(Cursor(), cenv.penv.sym("fn"), NULL); + List fn(Cursor(), cenv.penv.sym("lambda"), NULL); List fnProt; List fnArgs; diff --git a/test/ack.resp b/test/ack.scm index 76fb397..b996bf6 100644 --- a/test/ack.resp +++ b/test/ack.scm @@ -1,4 +1,4 @@ -(def (ack m n) +(define (ack m n) (if (= 0 m) (+ n 1) (= 0 n) (ack (- m 1) 1) (ack (- m 1) (ack m (- n 1))))) diff --git a/test/closure.resp b/test/closure.resp deleted file mode 100644 index 8dad1c1..0000000 --- a/test/closure.resp +++ /dev/null @@ -1,6 +0,0 @@ -(def (multiplier factor) - (fn (x) (* (+ x 0) factor))) - -(def doubler (multiplier 2)) - -(doubler 3) diff --git a/test/closure.scm b/test/closure.scm new file mode 100644 index 0000000..baaaead --- /dev/null +++ b/test/closure.scm @@ -0,0 +1,6 @@ +(define (multiplier factor) + (lambda (x) (* (+ x 0) factor))) + +(define doubler (multiplier 2)) + +(doubler 3) diff --git a/test/def.resp b/test/def.resp deleted file mode 100644 index 52605b0..0000000 --- a/test/def.resp +++ /dev/null @@ -1,8 +0,0 @@ -(def foo - (fn (x) - (def y x) - (def z (+ x 1)) - z)) - -(foo 3) - diff --git a/test/def.scm b/test/def.scm new file mode 100644 index 0000000..6730b9d --- /dev/null +++ b/test/def.scm @@ -0,0 +1,8 @@ +(define foo + (lambda (x) + (define y x) + (define z (+ x 1)) + z)) + +(foo 3) + diff --git a/test/deffn.resp b/test/deffn.resp deleted file mode 100644 index c413ecd..0000000 --- a/test/deffn.resp +++ /dev/null @@ -1,3 +0,0 @@ -(def f (fn (x) (+ x 1))) - -(f 2) diff --git a/test/deffn.scm b/test/deffn.scm new file mode 100644 index 0000000..3550a39 --- /dev/null +++ b/test/deffn.scm @@ -0,0 +1,3 @@ +(define f (lambda (x) (+ x 1))) + +(f 2) diff --git a/test/fac.resp b/test/fac.resp deleted file mode 100644 index 0fb687c..0000000 --- a/test/fac.resp +++ /dev/null @@ -1,7 +0,0 @@ -; Factorial -(def (fac n) - (if (= 0 n) 1 - (* n (fac (- n 1))))) - -(fac 6) - diff --git a/test/fac.scm b/test/fac.scm new file mode 100644 index 0000000..0ed384d --- /dev/null +++ b/test/fac.scm @@ -0,0 +1,7 @@ +; Factorial +(define (fac n) + (if (= 0 n) 1 + (* n (fac (- n 1))))) + +(fac 6) + diff --git a/test/inlinefn.resp b/test/inlinefn.resp deleted file mode 100644 index 2f055bd..0000000 --- a/test/inlinefn.resp +++ /dev/null @@ -1 +0,0 @@ -((fn (x) (+ x 1)) 1) diff --git a/test/inlinefn.scm b/test/inlinefn.scm new file mode 100644 index 0000000..d5073e8 --- /dev/null +++ b/test/inlinefn.scm @@ -0,0 +1 @@ +((lambda (x) (+ x 1)) 1) diff --git a/test/let-over-fn.resp b/test/let-over-fn.resp deleted file mode 100644 index be3131f..0000000 --- a/test/let-over-fn.resp +++ /dev/null @@ -1,7 +0,0 @@ -(def inc - (let (x 1) - (fn (y) (+ x y)))) - -(inc 1) - -
\ No newline at end of file diff --git a/test/let-over-fn.scm b/test/let-over-fn.scm new file mode 100644 index 0000000..5fc3b78 --- /dev/null +++ b/test/let-over-fn.scm @@ -0,0 +1,7 @@ +(define inc + (let (x 1) + (lambda (y) (+ x y)))) + +(inc 1) + +
\ No newline at end of file diff --git a/test/let.resp b/test/let.scm index 49623a6..67858b6 100644 --- a/test/let.resp +++ b/test/let.scm @@ -1,4 +1,4 @@ -(def one 1) +(define one 1) (let (two (+ one 1) three (+ one 2)) diff --git a/test/match.resp b/test/match.scm index 0df0568..db19be1 100644 --- a/test/match.resp +++ b/test/match.scm @@ -4,11 +4,11 @@ (Rectangle Float Float)) ; Return the area of s -(def (area s) +(define (area s) (match s (Rectangle w h) (* w h) (Circle r) (* 3.14159 r))) -(def s (Rectangle 3.0 4.0)) +(define s (Rectangle 3.0 4.0)) (area s)
\ No newline at end of file diff --git a/test/nest.resp b/test/nest.scm index c15c453..dac0f96 100644 --- a/test/nest.resp +++ b/test/nest.scm @@ -1,5 +1,5 @@ -(def (f x) - (def (g y) +(define (f x) + (define (g y) (* y 2)) (g (+ x 1))) diff --git a/test/poly.resp b/test/poly.scm index 1857fdf..d642a0d 100644 --- a/test/poly.resp +++ b/test/poly.scm @@ -1,4 +1,4 @@ -(def (eq x y) (= x y)) +(define (eq x y) (= x y)) (eq 1 2) (eq 1 1) diff --git a/test/quote.resp b/test/quote.scm index 638e81b..4895d2e 100644 --- a/test/quote.resp +++ b/test/quote.scm @@ -5,9 +5,9 @@ (Empty)) -(def list (quote (2 a b c))) +(define list (quote (2 a b c))) -(def (len l) +(define (len l) (match l (Symbol s) 1 diff --git a/test/string.resp b/test/string.resp deleted file mode 100644 index ff980a9..0000000 --- a/test/string.resp +++ /dev/null @@ -1,4 +0,0 @@ -(def greeting "Hello, world!") - -greeting - diff --git a/test/string.scm b/test/string.scm new file mode 100644 index 0000000..1e1e81e --- /dev/null +++ b/test/string.scm @@ -0,0 +1,4 @@ +(define greeting "Hello, world!") + +greeting + diff --git a/test/tup.resp b/test/tup.scm index e856f81..502db54 100644 --- a/test/tup.resp +++ b/test/tup.scm @@ -1,4 +1,4 @@ -(def t (Tup 1 2 3 4 5)) +(define t (Tup 1 2 3 4 5)) (. t 0) (. t 1) (. t 2) @@ -96,26 +96,26 @@ def test(ctx): Logs.error("ERROR: %s" % prog) # Basic lexical sanity - run_test('./test/def.resp', '4 : Int') - run_test('./test/deffn.resp', '3 : Int') - run_test('./test/inlinefn.resp', '2 : Int') - run_test('./test/nest.resp', '8 : Int') + run_test('./test/def.scm', '4 : Int') + run_test('./test/deffn.scm', '3 : Int') + run_test('./test/inlinefn.scm', '2 : Int') + run_test('./test/nest.scm', '8 : Int') # Basic data types - run_test('./test/string.resp', '"Hello, world!" : String') - run_test('./test/tup.resp', '5 : Int') + run_test('./test/string.scm', '"Hello, world!" : String') + run_test('./test/tup.scm', '5 : Int') # Recursive arithmetic functions - run_test('./test/fac.resp', '720 : Int') - run_test('./test/ack.resp', '8189 : Int') + run_test('./test/fac.scm', '720 : Int') + run_test('./test/ack.scm', '8189 : Int') # Closures - run_test('./test/closure.resp', '6 : Int') - run_test('./test/let-over-fn.resp', '2 : Int') - run_test('./test/let.resp', '5 : Int') + run_test('./test/closure.scm', '6 : Int') + run_test('./test/let-over-fn.scm', '2 : Int') + run_test('./test/let.scm', '5 : Int') # Algebraic data types - run_test('./test/match.resp', '12.0000 : Float') + run_test('./test/match.scm', '12.0000 : Float') # Quoting - run_test('./test/quote.resp', '4 : Int') + run_test('./test/quote.scm', '4 : Int') |