diff options
Diffstat (limited to 'generic.mu')
-rw-r--r-- | generic.mu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic.mu b/generic.mu index 8b65d109..351d4552 100644 --- a/generic.mu +++ b/generic.mu @@ -1,8 +1,8 @@ ; To demonstrate generic functions, we'll construct a factorial function with ; separate base and recursive clauses. Compare factorial.mu. -; def factorial n = n*factorial(n-1) -(def factorial [ +; factorial n = n*factorial(n-1) +(function factorial [ ((default-scope scope-address) <- new (scope literal) (30 literal)) ((n integer) <- input (0 literal)) more-clauses @@ -12,7 +12,7 @@ (reply (result integer)) ]) -; def factorial 0 = 1 +; factorial 0 = 1 (after factorial/more-clauses [ { begin ((zero? boolean) <- equal (n integer) (0 literal)) @@ -21,7 +21,7 @@ } ]) -(def main [ +(function main [ ((1 integer) <- factorial (5 literal)) (print-primitive ("result: " literal)) (print-primitive (1 integer)) |