Section 31
Want more of a challenge? View in
iconic
form (
experimental
)
# OBJECT introduce simple mutable structures
[
hear
]
(define mutable-struct /
? lst /
let
(
(data
(map
(? x / make-cell 0)
(lst)
)
)
)
(? key /
list-ref
(data)
(list-find
(lst)
(key)
(? x 0)
)
)
);
[
hear
]
(define test-struct1 /
mutable-struct /
vector item1 item2 item3);
[
hear
]
(set!
(test-struct1 item1)
15);
[
hear
]
(=
(get! / test-struct1 item1)
15);