Skip to content

Instantly share code, notes, and snippets.

@lihaoyi
Last active August 29, 2015 14:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Ammonite REPL Demo
[info] Running ammonite.repl.Repl
@ Range(0, 5).ma
max map maxBy
@ while(true) ()
Interrupted!
@ val x = 1
x: Int = 1
@ val y = 2
y: Int = 2
@ x * y
res3: Int = 2
@ x + y
res4: Int = 3
@ x = " X "
Compilation Failed
Main.scala:9: reassignment to val
val res5 = x = " X "
^
@ val x = " X "
x: java.lang.String = " X "
@ x * y
res6: String = " X X "
@ x + y
res7: java.lang.String = " X 2"
@ import ammonite.shell._
import ammonite.shell._
@ history
res9: scala.Seq[String] = Vector(
"while(true) ()",
"val x = 1",
"val y = 2",
"x * y",
"x + y",
"x = \" X \"",
"val x = \" X \"",
"x * y",
"x + y",
"import ammonite.shell._"
)
@ history |? grep! "val"
res10: Seq[String] = Vector("val x = 1", "val y = 2", "val x = \" X \"")
@ x
res11: java.lang.String = " X "
@ y
res12: Int = 2
@ history.slice(1, 3) |> load.lines
x: Int = 1
y: Int = 2
res13: Unit = ()
@ x
res16: Int = 1
@ y
res17: Int = 2
@ Seq(1, 2, 3).map(x => x.
getClass ## asInstanceOf isInstanceOf toString
hashCode equals != == %
/ * - + ^
& | >= > <=
< >> >>> << unary_-
unary_+ unary_~ toDouble toFloat toLong
toInt toChar toShort toByte compareTo
doubleValue floatValue longValue intValue shortValue
byteValue synchronized ne eq wait
notifyAll notify toDegrees toRadians floor
ceil round signum min max
abs isNegInfinity isPosInfinity isInfinity isNaN
isValidInt isValidChar isValidShort isValidByte isWhole
self to until ResultWithoutStep underlying
compare isInfinite toOctalString toHexString toBinaryString
isValidLong formatted ensuring → ->
|>
@ Seq(1, 2, 3).map(x => x.
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment