diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-13 10:03:26 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-13 10:03:26 -0700 |
commit | 5497090aa1e708c22cd240913a53dda32bb067aa (patch) | |
tree | 5a9eb76d447736a8199230c9386bd0a374b325dd /factorial.mu | |
parent | 01caf342d072115c27926b1a61c2fc75ab9fbee0 (diff) | |
download | mu-5497090aa1e708c22cd240913a53dda32bb067aa.tar.gz |
1363 - rename 'integer' to 'number'
..now that we support non-integers.
Diffstat (limited to 'factorial.mu')
-rw-r--r-- | factorial.mu | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/factorial.mu b/factorial.mu index 4b2126a8..a52cb8ae 100644 --- a/factorial.mu +++ b/factorial.mu @@ -2,31 +2,31 @@ recipe main [ default-space:address:space <- new location:type, 30:literal - x:integer <- factorial 5:literal - $print [result: ], x:integer, [ + x:number <- factorial 5:literal + $print [result: ], x:number, [ ] ] recipe factorial [ default-space:address:array:location <- new location:type, 30:literal - n:integer <- next-ingredient + n:number <- next-ingredient { # if n=0 return 1 - zero?:boolean <- equal n:integer, 0:literal + zero?:boolean <- equal n:number, 0:literal break-unless zero?:boolean reply 1:literal } # return n * factorial(n - 1) - x:integer <- subtract n:integer, 1:literal - subresult:integer <- factorial x:integer - result:integer <- multiply subresult:integer, n:integer - reply result:integer + x:number <- subtract n:number, 1:literal + subresult:number <- factorial x:number + result:number <- multiply subresult:number, n:number + reply result:number ] # unit test scenario factorial-test [ run [ - 1:integer <- factorial 5:literal + 1:number <- factorial 5:literal ] memory should contain [ 1 <- 120 |