shrub/mar/txt.hoon

268 lines
7.5 KiB
Plaintext
Raw Normal View History

2015-04-14 00:29:39 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/txt/mar
2014-09-12 06:11:03 +04:00
::
2016-02-18 02:00:12 +03:00
/? 310
2015-02-27 09:35:41 +03:00
!:
2015-12-20 23:50:45 +03:00
|_ txt/wain
2014-09-12 06:11:03 +04:00
::
++ grab :: convert from
|%
2015-12-20 23:50:45 +03:00
++ mime |=({p/mite q/octs} (lore q.q))
2015-02-27 09:35:41 +03:00
++ noun wain :: clam from %noun
++ json :(corl lore need so:jo)
2014-09-12 06:11:03 +04:00
--
2014-10-27 07:34:40 +03:00
++ grow
2015-02-27 09:35:41 +03:00
=> v=.
|%
++ mime => v [/text/plain (taco (role txt))]
2015-06-16 22:34:40 +03:00
++ elem => v ;pre: {(trip (role txt))}
2015-02-27 09:35:41 +03:00
--
++ grad
2014-10-27 07:34:40 +03:00
|%
2015-02-27 09:35:41 +03:00
++ form %txt-diff
++ diff
2015-12-20 23:50:45 +03:00
|= tyt/wain
2015-02-27 09:35:41 +03:00
^- (urge cord)
(lusk txt tyt (loss txt tyt))
2015-04-07 02:20:28 +03:00
::
2015-02-27 09:35:41 +03:00
++ pact
2015-12-20 23:50:45 +03:00
|= dif/(urge cord)
2015-04-14 00:29:39 +03:00
~| [%pacting dif]
2015-02-27 09:35:41 +03:00
^- wain
(lurk txt dif)
2015-04-07 02:20:28 +03:00
::
2015-02-27 09:35:41 +03:00
++ join
2015-12-20 23:50:45 +03:00
|= {ali/(urge cord) bob/(urge cord)}
2015-02-27 09:35:41 +03:00
^- (unit (urge cord))
|^
=. ali (clean ali)
=. bob (clean bob)
|- ^- (unit (urge cord))
?~ ali `bob
?~ bob `ali
?- -.i.ali
$&
2015-02-27 09:35:41 +03:00
?- -.i.bob
$&
2015-02-27 09:35:41 +03:00
?: =(p.i.ali p.i.bob)
%+ bind $(ali t.ali, bob t.bob)
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.ali cud])
2015-02-27 09:35:41 +03:00
?: (gth p.i.ali p.i.bob)
%+ bind $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob)
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.bob cud])
2015-02-27 09:35:41 +03:00
%+ bind $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali))
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.ali cud])
::
$|
2015-02-27 09:35:41 +03:00
?: =(p.i.ali (lent p.i.bob))
%+ bind $(ali t.ali, bob t.bob)
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.bob cud])
2015-02-27 09:35:41 +03:00
?: (gth p.i.ali (lent p.i.bob))
%+ bind $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.bob cud])
2015-02-27 09:35:41 +03:00
~
==
2015-04-14 00:29:39 +03:00
::
$|
2015-02-27 09:35:41 +03:00
?- -.i.bob
$| ~
$&
2015-02-27 09:35:41 +03:00
?: =(p.i.bob (lent p.i.ali))
%+ bind $(ali t.ali, bob t.bob)
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.ali cud])
2015-02-27 09:35:41 +03:00
?: (gth p.i.bob (lent p.i.ali))
%+ bind $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))
2015-12-20 23:50:45 +03:00
|=(cud/(urge cord) [i.ali cud])
2015-02-27 09:35:41 +03:00
~
==
==
++ clean :: clean
2015-12-20 23:50:45 +03:00
|= wig/(urge cord)
2015-02-27 09:35:41 +03:00
^- (urge cord)
?~ wig ~
?~ t.wig wig
2015-12-10 07:05:58 +03:00
?: ?=($& -.i.wig)
?: ?=($& -.i.t.wig)
2015-02-27 09:35:41 +03:00
$(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig])
[i.wig $(wig t.wig)]
2015-12-10 07:05:58 +03:00
?: ?=($| -.i.t.wig)
2015-02-27 09:35:41 +03:00
$(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig])
[i.wig $(wig t.wig)]
--
2015-04-04 04:31:57 +03:00
::
++ mash
2015-12-20 23:50:45 +03:00
|= $: {als/ship ald/desk ali/(urge cord)}
{bos/ship bod/desk bob/(urge cord)}
==
2015-04-04 04:31:57 +03:00
^- (urge cord)
2015-04-14 00:29:39 +03:00
|^
=. ali (clean ali)
=. bob (clean bob)
|- ^- (urge cord)
?~ ali bob
?~ bob ali
?- -.i.ali
$&
2015-04-14 00:29:39 +03:00
?- -.i.bob
$&
2015-04-14 00:29:39 +03:00
?: =(p.i.ali p.i.bob)
[i.ali $(ali t.ali, bob t.bob)]
?: (gth p.i.ali p.i.bob)
[i.bob $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob)]
[i.ali $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali))]
::
$|
2015-04-14 00:29:39 +03:00
?: =(p.i.ali (lent p.i.bob))
[i.bob $(ali t.ali, bob t.bob)]
?: (gth p.i.ali (lent p.i.bob))
[i.bob $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)]
2015-12-20 23:50:45 +03:00
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
2015-04-14 00:29:39 +03:00
(resolve ali bob)
[fic $(ali ali, bob bob)]
:: ~ :: here, alice is good for a while, but not for the whole
== :: length of bob's changes
::
$|
2015-04-14 00:29:39 +03:00
?- -.i.bob
$|
2015-12-20 23:50:45 +03:00
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
2015-04-14 00:29:39 +03:00
(resolve ali bob)
[fic $(ali ali, bob bob)]
::
$&
2015-04-14 00:29:39 +03:00
?: =(p.i.bob (lent p.i.ali))
[i.ali $(ali t.ali, bob t.bob)]
?: (gth p.i.bob (lent p.i.ali))
[i.ali $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))]
2015-12-20 23:50:45 +03:00
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
2015-04-14 00:29:39 +03:00
(resolve ali bob)
[fic $(ali ali, bob bob)]
==
==
::
++ annotate :: annotate conflict
2015-12-20 23:50:45 +03:00
|= $: ali/(list @t)
bob/(list @t)
bas/(list @t)
2015-04-14 00:29:39 +03:00
==
2015-12-10 12:17:19 +03:00
^- (list @t)
2015-04-14 00:29:39 +03:00
%- zing
2015-12-10 12:17:19 +03:00
^- (list (list @t))
2015-04-14 00:29:39 +03:00
%- flop
2015-12-10 12:17:19 +03:00
^- (list (list @t))
2015-04-14 00:29:39 +03:00
:- :_ ~
%^ cat 3 '<<<<<<<<<<<<'
%^ cat 3 ' '
%^ cat 3 `@t`(scot %p bos)
2015-04-14 00:29:39 +03:00
%^ cat 3 '/'
2015-07-15 01:32:12 +03:00
bod
2015-04-14 00:29:39 +03:00
:- bob
:- ~['------------']
:- bas
:- ~['++++++++++++']
:- ali
:- :_ ~
%^ cat 3 '>>>>>>>>>>>>'
%^ cat 3 ' '
%^ cat 3 `@t`(scot %p als)
2015-04-14 00:29:39 +03:00
%^ cat 3 '/'
ald
2015-04-14 00:29:39 +03:00
~
::
++ clean :: clean
2015-12-20 23:50:45 +03:00
|= wig/(urge cord)
2015-04-14 00:29:39 +03:00
^- (urge cord)
?~ wig ~
?~ t.wig wig
2015-12-10 07:05:58 +03:00
?: ?=($& -.i.wig)
?: ?=($& -.i.t.wig)
2015-04-14 00:29:39 +03:00
$(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig])
[i.wig $(wig t.wig)]
2015-12-10 07:05:58 +03:00
?: ?=($| -.i.t.wig)
2015-04-14 00:29:39 +03:00
$(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig])
[i.wig $(wig t.wig)]
::
++ resolve
2015-12-20 23:50:45 +03:00
|= {ali/(urge cord) bob/(urge cord)}
^- {fic/{$| p/(list cord) q/(list cord)} ali/(urge cord) bob/(urge cord)}
2015-04-14 00:29:39 +03:00
=- [[%| bac (annotate alc boc bac)] ali bob]
2015-12-20 23:50:45 +03:00
|- ^- $: $: bac/(list cord)
alc/(list cord)
boc/(list cord)
2015-04-14 00:29:39 +03:00
==
2015-12-20 23:50:45 +03:00
ali/(urge cord)
bob/(urge cord)
2015-04-14 00:29:39 +03:00
==
?~ ali [[~ ~ ~] ali bob]
?~ bob [[~ ~ ~] ali bob]
?- -.i.ali
$&
2015-04-14 00:29:39 +03:00
?- -.i.bob
$& [[~ ~ ~] ali bob] :: no conflict
$|
2015-04-14 00:29:39 +03:00
=+ lob=(lent p.i.bob)
?: =(lob p.i.ali)
[[p.i.bob p.i.bob q.i.bob] t.ali t.bob]
?: (lth lob p.i.ali)
[[p.i.bob p.i.bob q.i.bob] [[%& (sub p.i.ali lob)] t.ali] t.bob]
=+ wat=(scag (sub lob p.i.ali) p.i.bob)
2015-12-10 07:05:58 +03:00
=+ ^= res
%= $
ali t.ali
bob [[%| (scag (sub lob p.i.ali) p.i.bob) ~] t.bob]
==
2015-04-14 00:29:39 +03:00
:* :* (welp bac.res wat)
(welp alc.res wat)
(welp boc.res q.i.bob)
==
ali.res
bob.res
==
==
::
$|
2015-04-14 00:29:39 +03:00
?- -.i.bob
$&
2015-04-14 00:29:39 +03:00
=+ loa=(lent p.i.ali)
?: =(loa p.i.bob)
[[p.i.ali q.i.ali p.i.ali] t.ali t.bob]
?: (lth loa p.i.bob)
[[p.i.ali q.i.ali p.i.ali] t.ali [[%& (sub p.i.bob loa)] t.bob]]
=+ wat=(slag (sub loa p.i.bob) p.i.ali)
2015-12-10 07:05:58 +03:00
=+ ^= res
%= $
ali [[%| (scag (sub loa p.i.bob) p.i.ali) ~] t.ali]
bob t.bob
==
2015-04-14 00:29:39 +03:00
:* :* (welp bac.res wat)
(welp alc.res q.i.ali)
(welp boc.res wat)
==
ali.res
bob.res
==
::
$|
2015-04-14 00:29:39 +03:00
=+ loa=(lent p.i.ali)
=+ lob=(lent p.i.bob)
?: =(loa lob)
[[p.i.ali q.i.ali q.i.bob] t.ali t.bob]
=+ ^= res
?: (gth loa lob)
$(ali [[%| (scag (sub loa lob) p.i.ali) ~] t.ali], bob t.bob)
~& [%scagging loa=loa pibob=p.i.bob slag=(scag loa p.i.bob)]
$(ali t.ali, bob [[%| (scag (sub lob loa) p.i.bob) ~] t.bob])
:* :* (welp bac.res ?:((gth loa lob) p.i.bob p.i.ali))
(welp alc.res q.i.ali)
(welp boc.res q.i.bob)
==
ali.res
bob.res
==
==
==
--
2014-10-27 07:34:40 +03:00
--
2014-09-12 06:11:03 +04:00
--