This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait MapReduce[E, R] { | |
type S | |
def map(e: E): S | |
def reduce(s1: S, s2: S): S | |
def finish(s: S): R | |
} | |
def linear[E, R](seq: Array[E], mr: MapReduce[E, R]): R = | |
mr.finish(seq.map(mr.map).reduceLeft(mr.reduce)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binarySearch[B, A <% Ordered[B]](a: Array[A], v: B) = { | |
def recurse(low: Int, high: Int): Option[Int] = (low + high) / 2 match { | |
case _ if high < low => None | |
case mid if a(mid) > v => recurse(low, mid - 1) | |
case mid if a(mid) < v => recurse(mid + 1, high) | |
case mid => Some(mid) | |
} | |
recurse(0, a.size - 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.quartz | |
import org.quartz._ | |
class ScalaJob extends Job { | |
def execute(ctx: JobExecutionContext): Unit = { | |
ctx.getMergedJobDataMap.get("closure").asInstanceOf[JobExecutionContext => Unit].apply(ctx) | |
} | |
} | |
object QuartzTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tony Morris' Optional Exercises | |
// see http://scala-programming-language.1934581.n4.nabble.com/Further-understanding-scala-Option-td2334540.html | |
// Scala version 2.8.0.final | |
// http://scalacheck.googlecode.com/files/scalacheck_2.8.0-1.8-SNAPSHOT.jar | |
/* | |
Below are 15 exercises. The task is to emulate the scala.Option API | |
without using Some/None subtypes, but instead using a fold (called a | |
catamorphism). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% g8 | |
Getting Scala 2.8.0 ... | |
:: retrieving :: org.scala-tools.sbt#boot-scala | |
confs: [default] | |
2 artifacts copied, 0 already retrieved (14484kB/183ms) | |
Getting net.databinder giter8_2.8.0 0.1.1 ... | |
downloading http://scala-tools.org/repo-releases/net/databinder/giter8_2.8.0/0.1.1/giter8_2.8.0-0.1.1.jar ... | |
[SUCCESSFUL ] net.databinder#giter8_2.8.0;0.1.1!giter8_2.8.0.jar (596ms) | |
downloading http://maven.clapper.org/org/clapper/scalasti_2.8.0/0.5/scalasti_2.8.0-0.5.jar ... | |
[SUCCESSFUL ] org.clapper#scalasti_2.8.0;0.5!scalasti_2.8.0.jar (362ms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Project properties | |
#Mon Nov 01 17:04:45 CET 2010 | |
project.organization=test | |
project.name=sbt-specs-test | |
sbt.version=0.7.4 | |
project.version=1.0 | |
build.scala.versions=2.8.0 | |
project.initialize=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wolv.parserlibproblem | |
import util.parsing.ast.AbstractSyntax | |
import util.parsing.combinator.syntactical.TokenParsers | |
import util.parsing.combinator.lexical.Lexical | |
import util.parsing.combinator.token.Tokens | |
trait SimpleTokens extends Tokens { | |
case class Foo extends Token | |
case class Bar extends Token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Project properties | |
#Mon Mar 28 17:17:14 CEST 2011 | |
project.organization=vv | |
project.name=ParserTest | |
sbt.version=0.7.5.RC1 | |
project.version=1.0 | |
build.scala.versions=2.8.1 | |
project.initialize=false |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.