Book
Collections and ranges
Use lists for sequences, products for fields, and ranges for inclusive integer spans.
Sequences are lists
A list is Echo’s core ordered collection. Index it for direct access or iterate when order matters. Lists are shared objects, so mutation through a parameter or alias is deliberate and visible to the caller.
$ bump_first = (items) {
~ items[0] = items[0] + 1
^ items[0]
}
$ values = [10, 20, 30]
$ first = bump_first(values)Products group fields
An anonymous product is useful for a small bundle returned or passed as one value. Reach for a named struct when the shape is part of the domain, needs defaults or methods, or must participate in a type match. Neither form is a general dictionary.
$ coordinate = { x: 4, y: 7 }
$ horizontal = coordinate.xRanges compose
A range is an ordinary value. The same inclusive 1..10 span can be bound, iterated, passed, or used for membership in a match arm.