Last active
August 29, 2015 14:03
-
-
Save privateblue/02df525d7cef9eac1f65 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
sealed trait Expr { | |
def value: Int | |
} | |
case class Num(n: Int) extends Expr { | |
def value = n | |
} | |
case class Add(e1: Expr, e2: Expr) extends Expr { | |
def value = e1.value + e2.value | |
} | |
case class Sub(e1: Expr, e2: Expr) extends Expr { | |
def value = e1.value - e2.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment