diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 10:30:24 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 10:30:24 -0700 |
commit | 51b0936fc78814134c2e90256fda6e048ba5244e (patch) | |
tree | b8bd8321e982be64e5d40972c69da61d93f74b3d /070table.mu | |
parent | 7a84094adbf7570e0b9716d8f469458b901efec8 (diff) | |
download | mu-51b0936fc78814134c2e90256fda6e048ba5244e.tar.gz |
3386
Diffstat (limited to '070table.mu')
-rw-r--r-- | 070table.mu | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/070table.mu b/070table.mu index 6c4cf041..f3b2c10a 100644 --- a/070table.mu +++ b/070table.mu @@ -33,7 +33,7 @@ container table:_key:_value [ ] container table_row:_key:_value [ - occupied?:boolean + occupied?:bool key:_key value:_value ] @@ -56,8 +56,8 @@ def put-index table:address:table:_key:_value, key:_key, value:_value -> table:a hash <- abs hash # in case hash overflows into a negative integer table-data:address:array:table_row:_key:_value <- get *table, data:offset x:table_row:_key:_value <- index *table-data, hash - occupied?:boolean <- get x, occupied?:offset - not-occupied?:boolean <- not occupied?:boolean + occupied?:bool <- get x, occupied?:offset + not-occupied?:bool <- not occupied?:bool assert not-occupied?, [can't handle collisions yet] new-row:table_row:_key:_value <- merge 1/true, key, value *table-data <- put-index *table-data, hash, new-row @@ -66,7 +66,7 @@ def put-index table:address:table:_key:_value, key:_key, value:_value -> table:a def abs n:num -> result:num [ local-scope load-ingredients - positive?:boolean <- greater-or-equal n, 0 + positive?:bool <- greater-or-equal n, 0 return-if positive?, n result <- multiply n, -1 ] @@ -81,7 +81,7 @@ def index table:address:table:_key:_value, key:_key -> result:_value [ hash <- abs hash # in case hash overflows into a negative integer table-data:address:array:table_row:_key:_value <- get *table, data:offset x:table_row:_key:_value <- index *table-data, hash - occupied?:boolean <- get x, occupied?:offset + occupied?:bool <- get x, occupied?:offset assert occupied?, [can't handle missing elements yet] result <- get x, value:offset ] |