Language Guide / Lists, Records & Collections

Lists, Records & Collections

Immutable lists and records, append, field access, and mutable collections structures.

Immutable Lists & Records

List literals ([...]) and record literals ({...}) are immutable values. Use append(list, item) to produce a new list with an added element.

data.dl
tags = ["math", "native"]
tags = append(tags, "fast")
show len(tags)

person = {name: "Ada", role: "Engineer"}
show person.name

Mutable collections Module

When you need in-place mutation for performance, import collections for MutList, MutMap, MutSet, and MutDeque:

mut.dl
import collections

m = collections.map()
collections.set(m, "count", 42)
show collections.get(m, "count")

s = collections.set_from([1, 2, 2, 3])
show len(s)   # 3