- JDKがinstall済みであること
- java コマンドに環境変数Pathが通っていること
This file contains hidden or 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
#!/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] |
This file contains hidden or 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 funsets | |
import common._ | |
/** | |
* 2. Purely Functional Sets. | |
*/ | |
object FunSets { | |
/** | |
* We represent a set by its characteristic function, i.e. |
This file contains hidden or 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 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) + " ") |
This file contains hidden or 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
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 |
initial