Created
June 14, 2019 08:53
-
-
Save pkese/66ce4f3d6cda8185053f6b1c3eb443e4 to your computer and use it in GitHub Desktop.
BoolExpr eval in F#
This file contains 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
type Expr = | |
| And of Expr * Expr | |
| Or of Expr * Expr | |
| Not of Expr | |
| Const of bool | |
let rec eval = function | |
| And (x,y) -> eval x && eval y | |
| Or (x,y) -> eval x || eval y | |
| Not x -> not (eval x) | |
| Const x -> x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment