Skip to content

Instantly share code, notes, and snippets.

@pkese
Created June 14, 2019 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkese/66ce4f3d6cda8185053f6b1c3eb443e4 to your computer and use it in GitHub Desktop.
Save pkese/66ce4f3d6cda8185053f6b1c3eb443e4 to your computer and use it in GitHub Desktop.
BoolExpr eval in F#
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