Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Microsoft.FSharp.Collections.LazyList
- let rec merge a b =
- let cons' x f = LazyList.consDelayed x f
- match a, b with
- | (Cons(x, xs) as left), (Cons(y, ys) as right) ->
- if x < y then cons' x (fun () -> merge xs right)
- elif x > y then cons' y (fun () -> merge left ys)
- else cons' x (fun () -> cons' y (fun() -> merge xs ys))
- | Nil, ys -> ys
- | xs, Nil -> xs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement