update.min
· 844 B · Text
Brut
Playground
(symbol update
(quot|dict :structure quot :path quot :operation ==> quot|dict :updated) (
path first :index
(
((path size 1 == structure "quot" type? and) (
structure structure index get operation -> index set @updated
))
((path size 1 == structure "dict" type? and) (
structure structure index dict.get operation -> index dict.set @updated
))
((structure "quot" type?) (
structure index get path rest operation update :value
structure value index set @updated
))
((structure "dict" type?) (
structure index dict.get path rest operation update :value
structure value index dict.set @updated
))
) case
)
) ::
1 | (symbol update |
2 | (quot|dict :structure quot :path quot :operation ==> quot|dict :updated) ( |
3 | path first :index |
4 | ( |
5 | ((path size 1 == structure "quot" type? and) ( |
6 | structure structure index get operation -> index set @updated |
7 | )) |
8 | |
9 | ((path size 1 == structure "dict" type? and) ( |
10 | structure structure index dict.get operation -> index dict.set @updated |
11 | )) |
12 | |
13 | ((structure "quot" type?) ( |
14 | structure index get path rest operation update :value |
15 | structure value index set @updated |
16 | )) |
17 | |
18 | ((structure "dict" type?) ( |
19 | structure index dict.get path rest operation update :value |
20 | structure value index dict.set @updated |
21 | )) |
22 | ) case |
23 | ) |
24 | ) :: |