Skip to content

Instantly share code, notes, and snippets.

@WimJongeneel
Last active January 2, 2020 08:20
Show Gist options
  • Save WimJongeneel/65712db9bf74932c9047809410f0e4a0 to your computer and use it in GitHub Desktop.
Save WimJongeneel/65712db9bf74932c9047809410f0e4a0 to your computer and use it in GitHub Desktop.
const runExpr = (e: Expr, i: any): any => {
if (e.kind == 'acs') return i[e.id]
if (e.kind == '==') return runExpr(e.left, i) == runExpr(e.right, i)
if (e.kind == 'includes') return runExpr(e.left, i).contains(runExpr(e.right, i))
if (e.kind == '&&') return runExpr(e.left, i) && runExpr(e.right, i)
if (e.kind == 'val') return e.value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment