link: avoid duplicate entries when merging lists
Otherwise we might store entries we had already heard previously.
~| path
(woad (slav %ta i.path))
::
-:: zip sorted a into sorted b, maintaining sort order
-::TODO stdlib
-++ merge-sorted
+:: zip sorted a into sorted b, maintaining sort order, avoiding duplicates
+::
+++ merge-sorted-unique
|* [sort=$-([* *] ?) a=(list) b=(list)]
|- ^- ?(_a _b)
?~ a b
?~ b a
+ ?: =(i.a i.b)
+ [i.a $(a t.a, b t.b)]
?: (sort i.a i.b)
[i.a $(a t.a)]
[i.b $(b t.b)]
::TODO we would just use +cury here but it don't work
|= [a=^pages b=^pages]
^+ a
- %+ merge-sorted
+ %+ merge-sorted-unique
|= [a=page b=page]
(gth time.a time.b)
[a b]
++ submissions
|= [a=^submissions b=^submissions]
^+ a
- %+ merge-sorted
+ %+ merge-sorted-unique
|= [a=submission b=submission]
(gth time.a time.b)
[a b]
++ notes
|= [a=^notes b=^notes]
^+ a
- %+ merge-sorted
+ %+ merge-sorted-unique
|= [a=note b=note]
(gth time.a time.b)
[a b]
++ comments
|= [a=^comments b=^comments]
^+ a
- %+ merge-sorted
+ %+ merge-sorted-unique
|= [a=comment b=comment]
(gth time.a time.b)
[a b]
