Hash literals are built with an h token followed by curly brackets, then a comma-delimited key/value pair list, using a colon between key and value.

h{1: "first", 2: "second"} h{"abc": 123, "def": 789} h{true: 1, false: 7}

Hashes may use strings, numbers, or Booleans for keys. Different key types may be used in the same hash.

Indexing a hash with 1.0 is the same as indexing with 1. (Numbers are simplified for hash keys.)

Number hash keys requiring e-notation are not allowed.

Hashes may contain any other langur data structures, and they may be mixed freely.

Hashes may be appended with the concatenation operator (tilde). Concatenation overwrites values for existing keys in the left operand with values having the same keys in the right operand.

h{1: "first", 2: "second"} ~ h{3: "third", 2: "new second"}

To add hashes together, but error out on duplicate keys, use the more() function.

more h{1: "first", 2: "second"}, h{3: "third", 2: "new second"} # throws exception because key 2 in each hash

The toHash(), keys(), haskey(), map(), more(), and less() functions may be useful in dealing with hashes.