Qu

dict

Builtin index · Collections & strings

result = dict() or dict(k, v, ...)

Input: no input · Output: result

What it is

With no arguments: an empty store. Otherwise k/v are parallel Vec/List of keys and values (Str or number keys).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = dict() or dict(k, v, ...)no input
result Dict, number, or string
Returns a Dict, insertion-ordered. Keys are compared as given, so a number and the string of that number are different keys.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

d = dict(["a", "b"], [1, 2])
d = set(d, "c", 3)
print(get(d, "b"))       # 2

print(keys(d))           # ("a", "b", "c")

print(values(d))         # (1, 2, 3)

print(items(d))          # (("a", 1), ("b", 2), ("c", 3))

print(has_key(d, "c"))   # true

print(has_key(d, "z"))   # false

output
2
("a", "b", "c")
(1, 2, 3)
(("a", 1), ("b", 2), ("c", 3))
true
false

from collections-strings

How it works

dict(...) (§47.4, 2026-08-26) — value_to_json's own "dict" tag, "record"'s inverse verbatim since the on-disk shape is identical (keys + data), just reconstructing a Value::Dict.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.