No description
Find a file
LemonBoy 78df64c5be Fix edge case on del/contains and empty dict
Also add getOrDefault and rework some test code.
2019-02-12 19:02:55 +01:00
src Fix edge case on del/contains and empty dict 2019-02-12 19:02:55 +01:00
tests Fix edge case on del/contains and empty dict 2019-02-12 19:02:55 +01:00
compactdict.nimble intial upload 2019-01-31 22:52:55 +01:00
README.md Fix the example in the readme 2019-02-01 21:07:24 +01:00

CompactDict

A compact dictionary implementation kindly borrowed from Python.

Features

  • The insertion order is preserved
  • No need to initialize the Dict object before using it
  • More memory efficient for small & medium sized collections
  • Same API as stdlib's Table

Examples

var x = {"foo": 1, "bar": 2}.toDict()
echo x["foo"] # prints 1
for k, v in x.pairs():
  echo k, " = ", v # prints "foo" = 1 and "bar" = 2