Skip to content

Instantly share code, notes, and snippets.

@kiritsuku
kiritsuku / listimpl.scala
Created August 4, 2011 21:59
own implementation of Scalas List
package listimpl
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.Scope
class LinkedListTest extends SpecificationWithJUnit {
"LinkedList" should {
"have elements" in new Test {
xs.size === 3
@kiritsuku
kiritsuku / scala-reserved-keywords-and-symbols
Created July 12, 2011 09:39
the reserved keywords and symbols of Scala.
Scala 2.9
keywords (39):
abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try true type val var while with yield
symbols (12):
_ : = => <- <: <% >: # @
⇒ (Unicode \u21D2) same as: =>
← (Unicode \u2190) same as: <-
@kiritsuku
kiritsuku / HelloWorld.scala
Created July 11, 2011 22:41
akka-actor based object orientated HelloWorld in Scala
import akka.actor.Actor
import akka.actor.Actor.actorOf
object HelloWorld extends App {
val a = actorOf[Hello]
a.start()
val resp = (a !! World) getOrElse sys.error("no response")
a.stop()
println(resp)
@kiritsuku
kiritsuku / HelloWorld.scala
Created July 11, 2011 22:19
Scala HelloWorld by self reference
object HelloWorld extends App {
val msg = new Hello with World
msg.show
}
trait Message {
def get: String
}
trait World extends Message {