tmux
tmux new -s myname
tmux a # (or at, or attach)
tumx a -d
| // 階乗計算 | |
| def fact(n: Int): Int = { | |
| n match { | |
| case 0 => 1 | |
| case _ => n * (n - 1) | |
| } | |
| } |
| // フィボナッチ数列 単純版 | |
| def fib(n:Int):Int = { | |
| n match { | |
| case x if (x <= 1) => x | |
| case _ => fib(n - 1) + fib(n - 2) | |
| } | |
| } |
| // project ディレクトリの下に plugins.sbt として | |
| // 実行は gen-idea | |
| resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" | |
| addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0") |
| #!/bin/sh | |
| exec scala "$0" "$@" | |
| !# | |
| val helpMessage = """ | |
| Usage: | |
| -n do not output the trailing newline | |
| -x repeat x times |
| import scala.io.Source | |
| object CheckLog { | |
| case class Args( | |
| filename: String, | |
| exp: String | |
| ) | |
| def main(args: Array[String]) { |
| //以前の最長文字列問題を 合成関数を使うように変更したバージョン | |
| // mississipi という文字列の中の最長重複文字を探す | |
| package takuya71 | |
| import takuya71.ExFunction._ | |
| class ExFunction[-ARG, +RET](f: ARG => RET) { | |
| def :>:[A](g: A => ARG): A => RET = f compose g | |
| def :*:(arg: ARG): RET = f(arg) |
| // Scala 実践プログラミングの grep の記事を参考にしたバージョン | |
| import scala.io.Source | |
| object CheckLog { | |
| case class Args( | |
| filename: String, | |
| exp: String | |
| ) |