Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2017 06:32
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 anonymous/20a5de1c0c2d569251cad332e91cd693 to your computer and use it in GitHub Desktop.
Save anonymous/20a5de1c0c2d569251cad332e91cd693 to your computer and use it in GitHub Desktop.
the description for this gist
type NoWrap[ScalaValue] = ScalaValue
val interpret = new Language[NoWrap] {
override def number(v: Int): NoWrap[Int] = v
override def increment(a: NoWrap[Int]): NoWrap[Int] = a + 1
override def add(a: NoWrap[Int], b: NoWrap[Int]): NoWrap[Int] = a + b
override def text(v: String): NoWrap[String] = v
override def toUpper(a: NoWrap[String]): NoWrap[String] = a.toUpperCase
override def concat(a: NoWrap[String], b: NoWrap[String]): NoWrap[String] = a + " " + b
override def toString(v: NoWrap[Int]): NoWrap[String] = v.toString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment