From: Mark Wooding Date: Wed, 18 Nov 2009 13:41:23 +0000 (+0000) Subject: f#: Tidy same_iterators_p a little. X-Git-Url: https://git.distorted.org.uk/~mdw/fringe/commitdiff_plain/6bce693f147dfca5affdeb04f93a41b7ebd76bb9 f#: Tidy same_iterators_p a little. Use Option.isNone rather than a multiline pattern match, and use a pattern guard to reduce failure cases. --- diff --git a/f#-fringe.fs b/f#-fringe.fs index 33e8f4d..45d011b 100644 --- a/f#-fringe.fs +++ b/f#-fringe.fs @@ -41,16 +41,11 @@ let list_iterator it = it |> fold_iterator (curry List.Cons) [] |> List.rev // Asnwer whether two iterators report the same items. let rec same_iterators_p ita itb = match next ita with - | None -> - match next itb with - | None -> true - | _ -> false + | None -> Option.isNone(next itb) | Some (a, ita) -> match next itb with - | None -> false - | Some (b, itb) -> - if a = b then same_iterators_p ita itb - else false + | Some (b, itb) when a = b -> same_iterators_p ita itb + | _ -> false ///-------------------------------------------------------------------------- /// Nodes and trees.