Skip to content

Instantly share code, notes, and snippets.

View ochafik's full-sized avatar

Olivier Chafik ochafik

View GitHub Profile
import scalaxy.beans._
new MyBean().set(foo = 10, bar = 12)
for (iteration <- 0 until iterations) {
for (i <- 0 until n) {
...
}
}
(0 until iterations).foreach(iteration => {
(0 until n).foreach(i => {
...
})
})
{
var iteration = 0
while (iteration < iterations) {
var i = 0
while (i < n) {
...
i += 1
}
iteration += 1
}
// Only works with 2.10.0+
scalaVersion := "2.10.0"
// Dependency at compilation-time only (not at runtime).
libraryDependencies += "com.nativelibs4java" %% "scalaxy-loops" % "0.3-SNAPSHOT" % "provided"
// Scalaxy/Loops snapshots are published on the Sonatype repository.
resolvers += Resolver.sonatypeRepo("snapshots")
import scalaxy.loops._
for (iteration <- 0 until iterations optimized) {
for (i <- 0 until n optimized) {
...
}
}
assert(a == b, "a == b (" + a + " != " + b + ")")
assert(a == b, s"a == b ($a != $b)")
import scalaxy.debug._
val a = 10
val b = 12
assert(a == b)
// this will throw:
// "assertion failed: a == b (10 != 12)"
@ochafik
ochafik / build.sbt
Last active December 13, 2015 20:08
// Only works with 2.10.0+
scalaVersion := "2.10.0"
// Dependency at compilation-time only (not at runtime).
libraryDependencies += "com.nativelibs4java" %% "scalaxy-debug" % "0.3-SNAPSHOT" % "provided"
// Scalaxy/Debug snapshots are published on the Sonatype repository.
resolvers += Resolver.sonatypeRepo("snapshots")