diff --git a/objc/Nu.m b/objc/Nu.m index d853041..7cb26df 100644 --- a/objc/Nu.m +++ b/objc/Nu.m @@ -5538,7 +5538,7 @@ - (id) initWithName:(NSString *)n parameters:(NuCell *)p body:(NuCell *)b - (NSString *) stringValue { - return [NSString stringWithFormat:@"(macro-1 %@ %@ %@)", name, [parameters stringValue], [body stringValue]]; + return [NSString stringWithFormat:@"(macro %@ %@ %@)", name, [parameters stringValue], [body stringValue]]; } - (void) dumpContext:(NSMutableDictionary*)context @@ -8874,8 +8874,6 @@ void load_builtins(NuSymbolTable *symbolTable) install(@"then", Nu_progn_operator); install(@"else", Nu_progn_operator); - install(@"macro-0", Nu_macro_0_operator); - install(@"macro-1", Nu_macro_1_operator); install(@"macro", Nu_macro_1_operator); install(@"macrox", Nu_macrox_operator); diff --git a/test/test_macrox.nu b/test/test_macrox.nu index 92ce93c..c198881 100644 --- a/test/test_macrox.nu +++ b/test/test_macrox.nu @@ -6,7 +6,7 @@ (class TestMacrox is NuTestCase (- (id) testIncMacro is - (macro-1 inc! (n) + (macro inc! (n) `(set ,n (+ ,n 1))) ;; Test the macro evaluation @@ -19,10 +19,10 @@ (assert_equal "(set a (+ a 1))" (newBody stringValue))) (- (id) testNestedMacro is - (macro-1 inc! (n) + (macro inc! (n) `(set ,n (+ ,n 1))) - (macro-1 inc2! (n) + (macro inc2! (n) `(progn (inc! ,n) (inc! ,n))) @@ -36,7 +36,7 @@ (- (id) testFactorialMacro is - (macro-1 mfact (n) + (macro mfact (n) `(if (== ,n 0) (then 1) (else (* (mfact (- ,n 1)) ,n)))) @@ -50,7 +50,7 @@ (- (id) testCallingContextForMacro is ;; Make sure we didn't ruin our calling context - (macro-1 mfact (n) + (macro mfact (n) `(if (== ,n 0) (then 1) (else (* (mfact (- ,n 1)) ,n)))) @@ -60,7 +60,7 @@ (- (id) testRestMacro is - (macro-1 myfor ((var start stop) *body) + (macro myfor ((var start stop) *body) `(let ((,var ,start)) (while (<= ,var ,stop) ,@*body @@ -77,50 +77,50 @@ (- (id) testNullArgMacro is ;; Make sure *args is set correctly with a null arg macro - (macro-1 set-a-to-1 () + (macro set-a-to-1 () (set a 1)) (set-a-to-1) (assert_equal 1 a)) (- (id) testBadArgsNullMacro is - (macro-1 nullargs () + (macro nullargs () nil) (assert_throws "NuDestructureException" (nullargs 1 2))) (- (id) testNoBindingsMacro is - (macro-1 no-bindings (_) + (macro no-bindings (_) nil) (assert_equal nil (no-bindings 1))) (- (id) testMissingSequenceArgument is - (macro-1 missing-sequence (_ b) + (macro missing-sequence (_ b) b) (assert_throws "NuDestructureException" (missing-sequence 1))) (- (id) testSkipBindingsMacro is - (macro-1 skip-bindings (_ b) + (macro skip-bindings (_ b) b) (assert_equal 2 (skip-bindings 1 2))) (- (id) testSingleCatchAllArgMacro is - (macro-1 single-arg (*rest) + (macro single-arg (*rest) (cons '+ *rest)) (assert_equal 6 (single-arg 1 2 3))) (- (id) testDoubleCatchAllArgMacro is - (macro-1 double-catch-all ((a *b) (c *d)) + (macro double-catch-all ((a *b) (c *d)) `(append (quote ,*b) (quote ,*d))) (assert_equal '(2 3 4 12 13 14) (double-catch-all (1 2 3 4) (11 12 13 14)))) (- (id) testRestoreImplicitArgsExceptionMacro is - (macro-1 concat () + (macro concat () (cons '+ *args)) (assert_throws "NuDestructureException" (concat 1 2 3)) @@ -135,7 +135,7 @@ (- (id) testRestoreArgsExceptionMacro is ;; Intentionally refer to undefined symbol - (macro-1 x (a b) + (macro x (a b) c) (set a 0) @@ -151,11 +151,11 @@ ;; Make sure a runtime exception is properly caught (set code '(+ 2 x)) - (macro-1 eval-it (sexp) `(eval ,sexp)) + (macro eval-it (sexp) `(eval ,sexp)) (assert_throws "NuUndefinedSymbol" (eval-it code))) (- (id) testMaskedVariablesMacro is - (macro-1 x (a b) + (macro x (a b) `(+ ,a ,b)) (set a 1) @@ -163,7 +163,7 @@ (assert_equal 1 a)) (- (id) testEmptyListArgsMacro is - (macro-1 donothing (a b) + (macro donothing (a b) b) (assert_equal 2 (donothing 1 2)) @@ -171,7 +171,7 @@ (assert_equal 2 (donothing nil 2))) (- (id) testEmptyListArgsRecursiveMacro is - (macro-1 let* (bindings *body) + (macro let* (bindings *body) (if (null? *body) (then (throw* "LetException" @@ -198,7 +198,7 @@ (let* () ))) (- (id) testDisruptCallingContextMacro is - (macro-1 leaky-macro (a b) + (macro leaky-macro (a b) `(set c (+ ,a ,b))) (assert_equal 5 (leaky-macro 2 3)) diff --git a/test/test_onlisp.nu b/test/test_onlisp.nu index a464382..eac973e 100644 --- a/test/test_onlisp.nu +++ b/test/test_onlisp.nu @@ -8,7 +8,7 @@ (class TestOnLisp is NuTestCase (- (id) testNil is - (macro-1 nil! (var) + (macro nil! (var) `(set ,var nil)) (set newBody (macrox (nil! a))) @@ -19,7 +19,7 @@ (assert_equal nil a)) (- (id) testOurWhen is - (macro-1 our-when (test *body) + (macro our-when (test *body) `(if ,test (progn ,@*body))) @@ -37,7 +37,7 @@ (assert_throws "NuUndefinedSymbol" b)) (- (id) testOurAnd is - (macro-1 our-and (*args) + (macro our-and (*args) (case (*args length) (0 t) (1 (car *args)) @@ -53,12 +53,12 @@ (assert_throws "NuUndefinedSymbol" n)) (- (id) testOurSum is - (macro-1 our-sum (*args) + (macro our-sum (*args) `(+ ,@*args)) (assert_equal 10 (our-sum 1 2 3 4))) (- (id) testOurFor is - (macro-1 myfor ((var start stop) *body) + (macro myfor ((var start stop) *body) `(let ((,var ,start) (__gstop ,stop)) ;; Only evaluate stop once (while (<= ,var __gstop) @@ -80,7 +80,7 @@ (set var (+ var i))) (assert_equal 55 var) - (macro-1 inc! (n) `(set ,n (+ ,n 1))) + (macro inc! (n) `(set ,n (+ ,n 1))) (set var 0) (set n 9) @@ -92,13 +92,13 @@ (assert_equal 55 var)) (- (id) testOurApply is - (macro-1 our-apply (f *data) + (macro our-apply (f *data) `(eval (cons ,f ,@*data))) (assert_equal 6 (our-apply + '(1 2 3)))) (- (id) fixme_testOurLet is - (macro-1 mylet (bindings *body) + (macro mylet (bindings *body) `((do ,(bindings map: (do (x) (car x))) ,@*body) @@ -110,7 +110,7 @@ (+ x y)))) (- (id) testNumericIf is - (macro-1 numeric-if (expr pos zero neg) + (macro numeric-if (expr pos zero neg) `(let ((__expr ,expr)) (cond ((> __expr 0) ,pos)