diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-12-12 17:54:31 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-12-12 17:54:31 -0800 |
commit | 5b82e7075e32b70219e792da9efa3b425764347d (patch) | |
tree | 06b486bb972390b3c0cb3d79406a17e02760373d /factorial.mu | |
parent | 484d764819a8a8895aebbecb6a06cfdf8de39f1e (diff) | |
download | mu-5b82e7075e32b70219e792da9efa3b425764347d.tar.gz |
401 - stop abbreviating ops
We expect users to come across mu from arbitrary bits of code, so try to make each line as self-contained as possible.
Diffstat (limited to 'factorial.mu')
-rw-r--r-- | factorial.mu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/factorial.mu b/factorial.mu index 9a07bc07..d94a9354 100644 --- a/factorial.mu +++ b/factorial.mu @@ -1,16 +1,16 @@ (def factorial [ ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((n integer) <- arg) + ((n integer) <- next-input) { begin ; if n=0 return 1 - ((zero? boolean) <- eq (n integer) (0 literal)) + ((zero? boolean) <- equal (n integer) (0 literal)) (break-unless (zero? boolean)) (reply (1 literal)) } ; return n*factorial(n-1) - ((x integer) <- sub (n integer) (1 literal)) + ((x integer) <- subtract (n integer) (1 literal)) ((subresult integer) <- factorial (x integer)) - ((result integer) <- mul (subresult integer) (n integer)) + ((result integer) <- multiply (subresult integer) (n integer)) (reply (result integer)) ]) |