Created
February 9, 2011 10:32
-
-
Save t0yv0/818276 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module NFA = | |
| [<CustomEquality>] | |
| [<CustomComparison>] | |
| type State<'T> = | |
| | Match | |
| | Branch of Pair<'T> | |
| | Read of int * ('T -> bool) * State<'T> | |
| member this.Key = | |
| match this with | |
| | Match -> 0 | |
| | Branch x -> x.k | |
| | Read (i, _, _) -> i | |
| override this.Equals other = | |
| match other with | |
| | :? State<'T> as o -> | |
| this.Key = o.Key | |
| | _ -> | |
| false | |
| override this.GetHashCode() = | |
| this.Key | |
| interface IComparable with | |
| member this.CompareTo other = | |
| compare (hash other) this.Key | |
| and Pair<'T> = | |
| { | |
| mutable k : int | |
| mutable x : State<'T> | |
| y : State<'T> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment