urbit/mar/plan.hoon

72 lines
2.1 KiB
Plaintext
Raw Normal View History

2016-03-24 23:57:05 +03:00
::
:::: /hoon/plan/mar
::
/? 310
2016-03-26 01:26:19 +03:00
/- plan-data, plan-diff
2016-03-24 23:57:05 +03:00
!:
:::: ~fyr
::
2016-03-26 01:26:19 +03:00
|_ all/(map knot plan-data)
2016-03-24 23:57:05 +03:00
::
++ grow :: convert to
|%
++ txt
%+ turn (sort (~(tap by all)) aor)
2016-03-26 01:26:19 +03:00
|= {a/knot b/iden c/(unit purf)} ^- cord
%- crip
"{(trip a)}: {(trip b)}".
"{?~(c "" ", {(earf u.c)}")}"
2016-03-24 23:57:05 +03:00
--
++ grab |% :: convert from
2016-03-26 01:26:19 +03:00
++ noun (map knot plan-data) :: clam from %noun
2016-03-24 23:57:05 +03:00
++ txt
2016-03-26 01:26:19 +03:00
=; fel
|= a/wain ^+ all
(malt (turn a |=(b/cord (rash b fel))))
;~ plug
urs:ab
;~(pfix col ace urs:ab)
(punt ;~(pfix com ace aurf:urlp))
==
2016-03-25 03:15:12 +03:00
++ mime |=({* a/octs} (txt (lore q.a))) :: XX mark translation
2016-03-24 23:57:05 +03:00
--
++ grad
|%
++ form %plan-diff
++ diff
=| out/plan-diff
2016-03-26 01:26:19 +03:00
|= neu/(map knot plan-data) ^+ out :: XXX map functions
2016-03-24 23:57:05 +03:00
:- =< (malt `(list {knot $~})`(murn (~(tap by all)) .))
2016-03-26 01:26:19 +03:00
|= {a/knot *} ^- (unit {knot $~})
2016-03-24 23:57:05 +03:00
?:((~(has by neu) a) ~ (some [a ~]))
=< (malt (murn (~(tap by neu)) .))
2016-03-26 01:26:19 +03:00
|= {a/knot b/plan-data} ^- (unit {knot plan-data})
2016-03-24 23:57:05 +03:00
?: =([~ b] (~(get by all) a))
~
(some [a b])
::
++ pact
|= dif/plan-diff ^+ all :: XXX map functions
=; neu (~(uni by neu) put.dif)
=+ del=(~(tap by del.dif))
|- ^+ all
?~ del all
$(del t.del, all (~(del by all) p.i.del))
2016-03-25 00:34:19 +03:00
::
++ can-join
|= {ali/plan-diff bob/plan-diff} ^- ?
?& =(~ (~(int by `(map knot *)`del.ali) put.bob)) :: no del-put
=(~ (~(int by `(map knot *)`put.ali) del.bob)) :: conflicts
.= (~(int by put.ali) put.bob) :: and all put
(~(int by put.bob) put.ali) :: values match
==
::
++ join
|= {ali/plan-diff bob/plan-diff}
^- (unit plan-diff)
?. (can-join ali bob)
~
(some [(~(uni by del.ali) del.bob) (~(uni by put.ali) put.bob)])
2016-03-24 23:57:05 +03:00
--
--