2015-08-04 02:49:34 +03:00
|
|
|
/- tree-include
|
2015-08-05 00:45:29 +03:00
|
|
|
!:
|
2015-08-04 02:49:34 +03:00
|
|
|
|%
|
2015-08-12 00:31:16 +03:00
|
|
|
++ extract
|
2015-12-10 12:34:00 +03:00
|
|
|
|= a+marl ^- tape
|
2015-08-12 00:31:16 +03:00
|
|
|
?~ a ~
|
|
|
|
%- weld :_ $(a t.a)
|
2015-12-10 12:34:00 +03:00
|
|
|
?. ?=(__(:/(**)) i.a)
|
2015-08-12 00:31:16 +03:00
|
|
|
$(a c.i.a)
|
|
|
|
v.i.a.g.i.a
|
|
|
|
::
|
|
|
|
++ getall
|
2015-12-13 05:51:23 +03:00
|
|
|
|= tag+(list mane)
|
|
|
|
|= ele+manx ^- marl
|
|
|
|
?: (lien tag |=(a+mane =(a n.g.ele)))
|
2015-08-12 00:31:16 +03:00
|
|
|
~[ele]
|
|
|
|
(zing (turn c.ele ..$))
|
2015-12-10 12:34:00 +03:00
|
|
|
::
|
|
|
|
++ baff |*({a+(unit) b+(trap)} ?^(a a *b))
|
2015-08-04 02:49:34 +03:00
|
|
|
++ find-in-tree
|
2015-12-10 12:34:00 +03:00
|
|
|
|* {paz+fist:jo fun+_+(* (unit))}
|
|
|
|
|= jon+json
|
2015-08-07 03:09:29 +03:00
|
|
|
=+ a=`(list json)`~[jon]
|
2015-08-05 00:45:29 +03:00
|
|
|
|^ (try)
|
|
|
|
++ try
|
|
|
|
|. ^+ *fun
|
|
|
|
?~ a ~
|
|
|
|
%+ biff (paz i.a)
|
2015-12-10 12:34:00 +03:00
|
|
|
|* {b+(list json) c+*} ^+ *fun
|
2015-08-05 00:45:29 +03:00
|
|
|
(baff (baff (fun c) try(a b)) try(a t.a))
|
|
|
|
--
|
2015-08-04 02:49:34 +03:00
|
|
|
::
|
2015-08-12 00:31:16 +03:00
|
|
|
++ map-to-json
|
2015-12-10 12:34:00 +03:00
|
|
|
|* {a+_+(* cord) b+_+(* json)}
|
2015-12-13 05:51:23 +03:00
|
|
|
|* c+(map) ^- json
|
2015-08-12 00:31:16 +03:00
|
|
|
~! c
|
2015-12-10 12:34:00 +03:00
|
|
|
(jobe (turn (~(tap by c)) |*({k+* v+*} [(a k) (b v)])))
|
2015-08-12 00:31:16 +03:00
|
|
|
::
|
2015-08-04 02:49:34 +03:00
|
|
|
++ json-front
|
2015-12-10 12:34:00 +03:00
|
|
|
|= a+json ^- json
|
2015-08-04 02:49:34 +03:00
|
|
|
=- (fall `(unit json)`- ~)
|
2015-08-07 03:09:29 +03:00
|
|
|
%. a
|
2015-08-04 02:49:34 +03:00
|
|
|
%+ find-in-tree (ot c/(ar some) gn/so ga/(om so) ~):jo
|
2015-12-10 12:34:00 +03:00
|
|
|
|= {nom+span atr+(map span cord)} ^- (unit json)
|
2015-08-04 02:49:34 +03:00
|
|
|
?. (~(has by atr) 'urb:front') ~
|
2015-12-10 12:34:00 +03:00
|
|
|
?> ?=($meta nom)
|
2015-08-04 02:49:34 +03:00
|
|
|
(biff (~(get by atr) %value) poja)
|
|
|
|
::
|
|
|
|
++ read-schem
|
|
|
|
=< (cook to-noun (cook to-tree apex))
|
|
|
|
|%
|
2015-12-10 12:34:00 +03:00
|
|
|
++ noun _|(term [noun noun]) :: shadow
|
|
|
|
++ data _|(term {n+@ l+noun r+data})
|
2015-08-04 02:49:34 +03:00
|
|
|
++ apex ;~(plug sym (star ;~(plug delim sym)))
|
|
|
|
++ delim ;~(pose (cold 0 dot) (cook lent (plus cab)))
|
2015-12-10 12:34:00 +03:00
|
|
|
++ to-noun |=(a+data ?@(a a [l.a $(a r.a)]))
|
2015-08-04 02:49:34 +03:00
|
|
|
++ to-tree
|
2015-12-10 12:34:00 +03:00
|
|
|
|= {acc+data a+(list {p+@u q+term})}
|
2015-08-04 02:49:34 +03:00
|
|
|
%+ roll a =< .(acc ^acc)
|
2015-12-10 12:34:00 +03:00
|
|
|
|= {{n+@u v+term} acc+data}
|
2015-08-04 02:49:34 +03:00
|
|
|
?@ acc [n acc v]
|
2015-08-05 00:45:29 +03:00
|
|
|
?: (gth n n.acc) [n (to-noun acc) v]
|
2015-08-04 02:49:34 +03:00
|
|
|
acc(r $(acc r.acc))
|
|
|
|
--
|
|
|
|
--
|