ææ¥ãHaskellåå¼·ä¼ã«è¡ãã®ã ãã©ã
[対象]
http://cotocoto.jp/event/29498
Haskellã§ãã£ããããæ°åãå¾ãã³ã¼ããæ¸ããã¨ãã§ããç¨åº¦ã®äºº
ã¨ã®ãã¨ãªã®ã§ããã£ããããæ°åãå¾ã¦ã¿ãã
fib n = case n of 0 -> 0 1 -> 1 _ -> fib (n-1) + fib (n-2)
ããããfib.hsã¨ãã«ä¿åãã¦ãghciã§
Prelude> :l fib.hs [1 of 1] Compiling Main ( fib.hs, interpreted ) Ok, modules loaded: Main. *Main> fib 0 0 *Main> fib 1 1 *Main> fib 5 5
ã¨ããæãã
Programming in Haskellãããããªãããªãã¨ãæ¸ãã¦ã¿ããã©ãåç¥è0ã§ãæ
å ±æºãè±èªãªã®ã§ãããã¸ãã ã£ãã