Skip to content

Instantly share code, notes, and snippets.

@mantognini
Created October 5, 2017 16:12
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 mantognini/4c1c6cfbf74a33ff780451cbb33e3942 to your computer and use it in GitHub Desktop.
Save mantognini/4c1c6cfbf74a33ff780451cbb33e3942 to your computer and use it in GitHub Desktop.
diff -r doc/ src/main/doc
diff -r doc/interpolations.md src/main/doc/interpolations.md
40c40
< ```scala
---
> ```tut:silent
50,55c50,52
< ```scala
< scala> val tpe = t"Boolean"
< tpe: mySymbols.interpolator.trees.Type = Boolean
<
< scala> val expr = e"1 + 1 == 2"
< expr: mySymbols.interpolator.trees.Expr = 1 + 1 == 2
---
> ```tut
> val tpe = t"Boolean"
> val expr = e"1 + 1 == 2"
60,64c57,58
< ```scala
< scala> e"let x: $tpe = $expr in !x"
< res1: mySymbols.interpolator.trees.Expr =
< val x: Boolean = 1 + 1 == 2
< ¬x
---
> ```tut
> e"let x: $tpe = $expr in !x"
76,81c70,72
< ```scala
< scala> e"true"
< res2: mySymbols.interpolator.trees.Expr = true
<
< scala> e"false"
< res3: mySymbols.interpolator.trees.Expr = false
---
> ```tut
> e"true"
> e"false"
87,89c78,79
< ```scala
< scala> e"1"
< res4: mySymbols.interpolator.trees.Expr = 1
---
> ```tut
> e"1"
94,99c84,86
< ```scala
< scala> val bigIntLit = e"1"
< bigIntLit: mySymbols.interpolator.trees.Expr = 1
<
< scala> bigIntLit.getType
< res5: mySymbols.interpolator.trees.Type = BigInt
---
> ```tut
> val bigIntLit = e"1"
> bigIntLit.getType
104,109c91,93
< ```scala
< scala> val intLit = e"1 : Int"
< intLit: mySymbols.interpolator.trees.Expr = 1
<
< scala> intLit.getType
< res6: mySymbols.interpolator.trees.Type = Int32Type
---
> ```tut
> val intLit = e"1 : Int"
> intLit.getType
112,117c96,98
< ```scala
< scala> val realLit = e"1 : Real"
< realLit: mySymbols.interpolator.trees.Expr = 1
<
< scala> realLit.getType
< res7: mySymbols.interpolator.trees.Type = Real
---
> ```tut
> val realLit = e"1 : Real"
> realLit.getType
123,125c104,105
< ```scala
< scala> e"3.75"
< res8: mySymbols.interpolator.trees.Expr = 15/4
---
> ```tut
> e"3.75"
131,133c111,112
< ```scala
< scala> e"'Hello world!'"
< res9: mySymbols.interpolator.trees.Expr = "Hello world!"
---
> ```tut
> e"'Hello world!'"
139,141c118,119
< ```scala
< scala> e"`a`"
< res10: mySymbols.interpolator.trees.Expr = 'a'
---
> ```tut
> e"`a`"
149,151c127,128
< ```scala
< scala> e"1 + 2 * 5 + 6 - 7 / 17"
< res11: mySymbols.interpolator.trees.Expr = ((1 + 2 * 5) + 6) - 7 / 17
---
> ```tut
> e"1 + 2 * 5 + 6 - 7 / 17"
157,164c134,135
< ```scala
< scala> e"if (1 == 2) 'foo' else 'bar'"
< res12: mySymbols.interpolator.trees.Expr =
< if (1 == 2) {
< "foo"
< } else {
< "bar"
< }
---
> ```tut
> e"if (1 == 2) 'foo' else 'bar'"
170,174c141,142
< ```scala
< scala> e"let word: String = 'World!' in concatenate('Hello ', word)"
< res13: mySymbols.interpolator.trees.Expr =
< val word: String = "World!"
< "Hello " + word
---
> ```tut
> e"let word: String = 'World!' in concatenate('Hello ', word)"
180,182c148,149
< ```scala
< scala> e"lambda x: BigInt, y: BigInt. x + y"
< res14: mySymbols.interpolator.trees.Expr = (x: BigInt, y: BigInt) => x + y
---
> ```tut
> e"lambda x: BigInt, y: BigInt. x + y"
187,189c154,155
< ```scala
< scala> e"λx: BigInt, y: BigInt. x + y"
< res15: mySymbols.interpolator.trees.Expr = (x: BigInt, y: BigInt) => x + y
---
> ```tut
> e"λx: BigInt, y: BigInt. x + y"
194,196c160,161
< ```scala
< scala> e"lambda x. x * 0.5"
< res16: mySymbols.interpolator.trees.Expr = (x: Real) => x * 1/2
---
> ```tut
> e"lambda x. x * 0.5"
205,210c170,172
< ```scala
< scala> e"forall x: Int. x > 0"
< res17: mySymbols.interpolator.trees.Expr = ∀x: Int. (x > 0)
<
< scala> e"∀x. x || true"
< res18: mySymbols.interpolator.trees.Expr = ∀x: Boolean. (x || true)
---
> ```tut
> e"forall x: Int. x > 0"
> e"∀x. x || true"
216,221c178,180
< ```scala
< scala> e"exists x: BigInt. x < 0"
< res19: mySymbols.interpolator.trees.Expr = ¬∀x: BigInt. (x >= 0)
<
< scala> e"∃x, y. x + y == 0"
< res20: mySymbols.interpolator.trees.Expr = ¬∀x: BigInt, y: BigInt. (x + y ≠ 0)
---
> ```tut
> e"exists x: BigInt. x < 0"
> e"∃x, y. x + y == 0"
227,232c186,188
< ```scala
< scala> e"choose x. x * 3 < 17"
< res21: mySymbols.interpolator.trees.Expr = choose((x: BigInt) => x * 3 < 17)
<
< scala> e"choose x: String. true"
< res22: mySymbols.interpolator.trees.Expr = choose((x: String) => true)
---
> ```tut
> e"choose x. x * 3 < 17"
> e"choose x: String. true"
diff -r doc/tutorial.md src/main/doc/tutorial.md
17c17
< ```scala
---
> ```tut:silent
58c58
< ```scala
---
> ```tut:silent
64c64
< ```scala
---
> ```tut:silent
70c70
< ```scala
---
> ```tut:silent
87c87
< ```scala
---
> ```tut:silent
142c142
< ```scala
---
> ```tut:silent
166c166
< ```scala
---
> ```tut:silent
194c194
< ```scala
---
> ```tut:silent
207c207
< ```scala
---
> ```tut:silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment