1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Add a function dividing a graph in two.

This commit is contained in:
Rob Rix 2017-03-10 11:55:46 -05:00
parent ec33d16355
commit 0e2f57821e

View File

@ -138,6 +138,11 @@ continue = return Nothing
ceilDiv :: Integral a => a -> a -> a
ceilDiv = (uncurry (+) .) . divMod
divideGraph :: EditGraph a -> Endpoint -> (EditGraph a, EditGraph a)
divideGraph (EditGraph as bs) (Endpoint x y) =
( EditGraph (Vector.slice 0 x as) (Vector.slice 0 y bs)
, EditGraph (Vector.slice x (length as - x) as) (Vector.slice y (length bs - y) bs) )
-- Instances