1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-26 05:23:35 +03:00
shrub/pkg/arvo/lib/tree.hoon

35 lines
1.0 KiB
Plaintext
Raw Normal View History

2016-02-05 05:57:44 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/tree/lib
2016-02-05 05:57:44 +03:00
::
2016-02-11 21:50:20 +03:00
/? 314
2016-11-17 04:42:58 +03:00
::
2015-08-04 02:49:34 +03:00
|%
2016-02-03 00:24:20 +03:00
++ getall :: search in manx
|= 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-08-04 02:49:34 +03:00
::
2016-02-03 00:24:20 +03:00
:: a.b_c.d => [[%a %b] [%c %d]]
:: a.b_c, a_b__c => [[%a %b] %c]
:: a_b_c, a__b_c => [%a [%b %c]]
++ read-schem :: decode gapped noun
=< (cook to-noun (cook build-grove apex))
2015-08-04 02:49:34 +03:00
|%
++ noun $@(term [noun noun]) :: shadow
2016-02-03 00:24:20 +03:00
:: improper list of possible entry points
++ grove $@(term [gap=@ sealed=noun pending=grove])
2015-08-04 02:49:34 +03:00
++ apex ;~(plug sym (star ;~(plug delim sym)))
++ delim ;~(pose (cold 0 dot) (cook lent (plus cab)))
++ to-noun |=(a=grove ?@(a a [sealed.a $(a pending.a)]))
2016-02-03 00:24:20 +03:00
++ build-grove
|= [a=grove b=(list [p=@u q=term])] ^- grove
2016-02-03 00:24:20 +03:00
%+ roll b =< .(acc a)
|= [[gap=@u v=term] acc=grove] ^- grove
2016-02-03 00:24:20 +03:00
?@ acc [gap acc v]
?: (gth gap gap.acc) [gap (to-noun acc) v]
acc(pending $(acc pending.acc))
2015-08-04 02:49:34 +03:00
--
--