Skip to content

Instantly share code, notes, and snippets.

View takei-shg's full-sized avatar

Shige Takei takei-shg

  • dotData, Inc.
  • San Mateo, CA
View GitHub Profile
#!/usr/bin/env ruby
def replace(index, list)
if (index == 0)
return list
end
if (list[index-1] < list[index])
return list
end
x = list[index-1]
@takei-shg
takei-shg / funsets.scala
Created October 2, 2013 23:33
FPP in Scala week2
package funsets
import common._
/**
* 2. Purely Functional Sets.
*/
object FunSets {
/**
* We represent a set by its characteristic function, i.e.
@takei-shg
takei-shg / recfun.scala
Last active December 23, 2015 23:09
FPP in Scala week1
package recfun
import common._
import scala.annotation.tailrec
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
for (col <- 0 to row)
print(pascal(col, row) + " ")

Scala 開発環境構築手順

前提条件

  • JDKがinstall済みであること
  • java コマンドに環境変数Pathが通っていること
@takei-shg
takei-shg / fibs.hs
Created September 4, 2013 07:15
fibs - Haskell
fib_slow :: Int -> Int
fib_slow 0 = 1
fib_slow 1 = 1
fib_slow n = fib_slow (n - 2) + fib_slow (n - 1)
fibs_slow :: Int -> [Int]
fibs_slow len = take len $ map fib_slow [0..]
fib :: Int -> Int
fib 0 = 1
@takei-shg
takei-shg / ParaConHaskell_3.md
Created August 23, 2013 07:42
Parallel and Concurrent Programing in Haskell : Chapter 3

initial

@takei-shg
takei-shg / ParaConHaskell_2.md
Last active December 21, 2015 05:58
Parallel and Concurrent Programing in Haskell : Chapter 2

Chap. 2 / Basic Parallelism : The Eval Monad

Lazy Evaluation and Weak Head Normal Form

  • Haskellでの式評価は、必要となるまで遅延される。並列実行ではどの段階で評価が実行されるのか意識する必要がある。
  • 以下、GHCiで検証する。
  • > let x = 1 + 2 :: Int
    • この段階でxは未評価なので、式の内容は1 + 2のままで、3ではない。
    • > :sprint x
    • x = _
@takei-shg
takei-shg / ParaConHaskell_1.md
Last active December 21, 2015 05:49
Parallel and Concurrent Programing in Haskell : Preface, Chapter1

Preface

  • Haskellでの並行・並列実行環境は整ってきた
    • GHCのShared Memory Multiprocessor環境におけるParallel化等
  • しかし、実装者に対するレクチャはまだないので書いた
  • Audience
    • RWH,Programming in Haskell,すごいH本 ... 等を読んでいる人たち
  • この本の読み方
    • 読むだけでなく、実装して確かめてほしい
  • Haskell界の変化はこの20年で一番速いのでLibraryが古くなっている可能性はある
@takei-shg
takei-shg / gist:5563644
Last active December 17, 2015 06:09
Install NetBSD 6.0.1 on VirtualBox

You need

  • 2GB disk space
  • installed VirtualBox

Install

  1. Download iso image. (ftp://iso.jp.netbsd.org/pub/NetBSD/iso/6.0.1/NetBSD-6.0.1-i386.iso)

  2. Create New Virtual Machine from VirtualBox

@takei-shg
takei-shg / equipment.md
Last active December 16, 2015 21:29 — forked from seizans/equipment.md

基本装備の入手経路

新社会人からをはじめ、ちょいちょい聞かれるので、自分の基本装備の入手経路をまとめた。

(takei-shg)
前提として、首周り、肩幅、袖丈、ウェスト、股下のサイズを把握しましょう。
比較の基準になります。

スーツ