Rewrite ++dedupe to roll instead of skim, and fix issue where it wasn't accounting for different cases correctly.

ie, it wasn't making sure that the found case was *actually* before the new request's case.
This commit is contained in:
Fang 2018-01-18 01:25:58 +01:00
parent 4671526a3e
commit e2b056eff9

View File

@ -696,35 +696,61 @@
:: ::
++ dedupe :: find existing alias ++ dedupe :: find existing alias
|= rov/rove ^- rove |= rov/rove ^- rove
=; ros/(list rove) ?+(ros rov {^ $~} i.ros) =; ron/(unit rove) (fall ron rov)
?- -.rov ?- -.rov
$sing ~ $sing ~
$next $next
?~ (case-to-aeon:ze q.p.rov) ~ =+ aey=(case-to-aeon:ze q.p.rov)
%+ skim ~(tap in ~(key by qyx)) ?~ aey ~
|= a=rove ^- ? %+ roll ~(tap in ~(key by qyx))
?& ?=($next -.a) |= {hav/rove res/(unit rove)}
=(p.a p.rov(q q.p.a)) ?^ res res
?=(^ (case-to-aeon:ze q.p.a)) =- ?:(- `hav ~)
?& ?=($next -.hav)
=(p.hav p.rov(q q.p.hav))
::
:: only a match if this request is before
:: or at our starting case.
=+ hay=(case-to-aeon:ze q.p.hav)
?~(hay | (lte u.hay u.aey))
== ==
:: ::
$mult $mult
?~ (case-to-aeon:ze q.p.rov) ~ =+ aey=(case-to-aeon:ze q.p.rov)
%+ skim ~(tap in ~(key by qyx)) ?~ aey ~
|= a=rove ^- ? %+ roll ~(tap in ~(key by qyx))
?& ?=($mult -.a) |= {hav/rove res/(unit rove)}
=(p.a p.rov(q q.p.a)) ?^ res res
?=(^ (case-to-aeon:ze q.p.a)) =- ?:(- `hav ~)
?& ?=($mult -.hav)
=(p.hav p.rov(q q.p.hav))
::
:: only a match if this request is before
:: or at our starting case, and it has been
:: tested at least that far.
=+ hay=(case-to-aeon:ze q.p.hav)
?& ?=(^ hay)
(lte u.hay u.aey)
?=(^ q.hav)
(gte u.q.hav u.aey)
==
== ==
:: ::
$many $many
?~ (case-to-aeon:ze p.q.rov) ~ =+ aey=(case-to-aeon:ze p.q.rov)
%+ skim ~(tap in ~(key by qyx)) ?~ aey ~
|= a=rove ^- ? %+ roll ~(tap in ~(key by qyx))
?& ?=($many -.a) |= {hav/rove res/(unit rove)}
=(a rov(p.q p.q.a)) ?^ res res
?=(^ (case-to-aeon:ze p.q.a)) =- ?:(- `hav ~)
== ?& ?=($many -.hav)
=(hav rov(p.q p.q.hav))
::
:: only a match if this request is before
:: or at our starting case.
=+ hay=(case-to-aeon:ze p.q.hav)
?~(hay | (lte u.hay u.aey))
==
== ==
:: ::
:: Takes a list of changed paths and finds those paths that are inside a :: Takes a list of changed paths and finds those paths that are inside a