Skip to content

Instantly share code, notes, and snippets.

View seratch's full-sized avatar

Kazuhiro Sera seratch

View GitHub Profile
@seratch
seratch / gist:1167669
Created August 24, 2011 09:18
S-99 P11-P20 My answers
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar
// scala -cp scalatest-*.jar s99-11-20.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1167860
Created August 24, 2011 11:32
S-99 P21-P28 blank
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar
// scala -cp scalatest*.jar s99-21-28.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1183495
Created August 31, 2011 13:06
S-99 P21-P28 My Work
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar
// scala -cp scal.test-*.jar s99-21-28.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1195253
Created September 5, 2011 15:28
S-99 P31-P35 blank
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.1/1.6.1/scalatest_2.9.1-1.6.1.jar
// scala -cp scalatest*.jar s99-31-35.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1200332
Created September 7, 2011 11:28
S-99 P31-P35 My Work
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.0-1/1.6.1/scalatest_2.9.0-1-1.6.1.jar
// scala -cp scalatest*.jar s99-31-35.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1213678
Created September 13, 2011 12:11
S-99 P36-P41 Blank
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.1/1.6.1/scalatest_2.9.1-1.6.1.jar
// scala -deprecation -cp scalatest*.jar s99-36-41.scala
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1216403
Created September 14, 2011 12:11
S99 P36-41 My Work
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
//
// wget http://www.scala-tools.org/repo-releases/org/scalatest/scalatest_2.9.1/1.6.1/scalatest_2.9.1-1.6.1.jar
// scala -deprecation -cp "scalatest*.jar" s99-36-41_work.scala
import org.scalatest.Assertions.intercept
import org.scalatest.matchers.ShouldMatchers._
class NotImplementedYet extends RuntimeException
@seratch
seratch / gist:1247808
Created September 28, 2011 12:27
#daimonscala 16
// *** S-99: Ninety-Nine Scala Problems ***
// http://aperiodic.net/phil/scala/s-99/
type B = Boolean
// P46: Truth tables for logical expressions.
// Define functions and, or, nand, nor, xor, impl,
// and equ (for logical equivalence) which return true or false
// according to the result of their respective operations;
// e.g. and(A, B) is true if and only if both A and B are true.
@seratch
seratch / gist:1281343
Created October 12, 2011 14:19
#daimonscala 18
import util.parsing.combinator._
abstract class Row
case class HeaderRow(cells: List[String]) extends Row
case class DataRow(cells: List[String]) extends Row
object CsvParser3 extends RegexParsers {
override val whiteSpace = "[ \t]+".r
def eol = opt('\r') <~ '\n'
def notQuotedCell = "[^\"\r\n,]*".r
@seratch
seratch / gist:1295847
Created October 18, 2011 16:13
#daimonscala 19-1 "JSON parser" Blank
// obj ::= "{" [members] "}".
// arr ::= "[" [values] "]".
// value ::= obj | arr | stringLiteral | floatingPointNumber | "null" | "true" | "false".
// values ::= value { "," value }.
// members ::= member { "," member }.
// member ::= stringLiteral ":" value.
object Main {
import util.parsing.combinator._