diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-31 21:59:47 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-31 21:59:47 -0700 |
commit | cdb9fbee922225a4b2db37cb9470403e45a569b7 (patch) | |
tree | 77b64b03d32c34da9f86410d698175816d89c3d0 | |
parent | 88b8d6124e199a61c302e4f7b826fbc991410076 (diff) | |
download | mu-cdb9fbee922225a4b2db37cb9470403e45a569b7.tar.gz |
3616
-rw-r--r-- | 070table.mu | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/070table.mu b/070table.mu index 1b3d5fd3..d567475c 100644 --- a/070table.mu +++ b/070table.mu @@ -62,14 +62,6 @@ def put-index table:&:table:_key:_value, key:_key, value:_value -> table:&:table *table-data <- put-index *table-data, hash-key, new-row ] -def abs n:num -> result:num [ - local-scope - load-ingredients - positive?:bool <- greater-or-equal n, 0 - return-if positive?, n - result <- multiply n, -1 -] - def index table:&:table:_key:_value, key:_key -> result:_value [ local-scope load-ingredients @@ -84,3 +76,11 @@ def index table:&:table:_key:_value, key:_key -> result:_value [ assert occupied?, [can't handle missing elements yet] result <- get x, value:offset ] + +def abs n:num -> result:num [ + local-scope + load-ingredients + positive?:bool <- greater-or-equal n, 0 + return-if positive?, n + result <- multiply n, -1 +] |