Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_austenite/tests/fixtures/eval/general/accessors.typ

737 bytes, 1 run

created by r1870400018:66104, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// `first`, `last` and `at` are accessors: a mutating method or an assignment through them changes the array in place.
2#metadata({
3 let a = ((1, 2), (3, 4), (5,))
4 a.last().push(6)
5 a.first().push(0)
6 a.at(1).push(9)
7 a
8}) <probe>
9#metadata({
10 let ctx = (groups: ((), ("a",)), names: (:))
11 ctx.groups.last().push("b")
12 ctx.groups.first().push("z")
13 if ctx.groups.len() > 0 { ctx.groups.last().push("c") }
14 ctx.names.at("k", default: none)
15 ctx
16}) <probe>
17#metadata({
18 let n = (1, 2, 3)
19 n.last() = 9
20 n.first() += 10
21 n.at(1) *= 4
22 n
23}) <probe>
24#metadata({
25 let d = (rows: ((1, 2), (3,)))
26 d.rows.last().push(4)
27 let _ = d.rows.first().remove(0)
28 d.rows.last().insert(0, 7)
29 d.rows.first().last() = 5
30 d
31}) <probe>