Skip to content

Instantly share code, notes, and snippets.

View takungsk's full-sized avatar
🏠
Working from home

Takuya Nagasaka takungsk

🏠
Working from home
View GitHub Profile

Haskell チートシート

インストール

$ brew install ghc 
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ghc-7.4.2.m
######################################################################## 100.0%
==> Pouring ghc-7.4.2.mountainlion.bottle.tar.gz
==> Caveats
@takungsk
takungsk / maze.scala
Created October 14, 2012 12:43 — forked from akr4/maze.scala
A* アルゴリズムで迷路を解く
scala> import maze._
import maze._
scala> val m = Mazes.load(new java.io.File("maze.txt"))
m: maze.Maze = maze.Maze@20ccb51
scala> Mazes.encodeRunLength(m.solve.get)
res0: List[(maze.Direction.Value, Int)] = List((S,1), (E,10), (S,2), (W,31), (N,4), (E,2), (S,2), (E,2), (N,4), (E,7), (N,1))
@takungsk
takungsk / avhash.scala
Created August 4, 2012 01:36 — forked from shinobu-aoki/avhash.scala
Average HashをScalaで書いてみた
import java.awt.image.{BufferedImage => BI}
import java.io.File
import javax.imageio.ImageIO
object avhash extends App {
val (w, h) = (16, 16)
def toHash(originFile: File) = {
def toGray(originFile: File) = {
val newImage = new BI(w, h, BI.TYPE_BYTE_GRAY)
val g = newImage.createGraphics()
@takungsk
takungsk / .gitignore
Created June 6, 2012 03:51 — forked from SethTisue/.gitignore
parse iTunes library XML, compile stats. shows how to use Scala's XML pull API, by putting some DSL-y goodness on top of it
/tunes.txt
@takungsk
takungsk / echo.scala
Created April 5, 2012 07:24 — forked from tototoshi/echo.scala
Scalaでスクリプトとか書くときのコマンドライン引数の解析
#!/bin/sh
exec scala "$0" "$@"
!#
val helpMessage = """
Usage:
-n do not output the trailing newline
-x repeat x times