summaryrefslogtreecommitdiff
path: root/lib/std/htab.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/htab.myr')
-rw-r--r--lib/std/htab.myr5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/htab.myr b/lib/std/htab.myr
index ccccfe9..ec4ce72 100644
--- a/lib/std/htab.myr
+++ b/lib/std/htab.myr
@@ -26,6 +26,7 @@ pkg std =
generic htgetv : (ht : htab(@k, @v)#, k : @k, fallback : @v-> @v)
generic hthas : (ht : htab(@k, @v)#, k : @k -> bool)
generic htkeys : (ht : htab(@k, @v)# -> @k[:])
+ generic htcount : (ht : htab(@k, @v)# -> std.size)
generic byhtkeyvals : (ht : htab(@k, @v)# -> htkviter(@k, @v))
impl iterable htkviter(@k, @v) -> (@k, @v)
@@ -207,6 +208,10 @@ generic htkeys = {ht
-> keys
}
+generic htcount = {ht
+ -> ht.nelt
+}
+
generic byhtkeyvals = {ht
-> [.ht = ht, .idx = 0]
}