.scala
ããããHaskellãã®ããå¦ã¼ã!ã ã® 10ç« ã®éãã¼ã©ã³ãè¨æ³é»åã Groovy, Scala, Clojure, Scheme ã§æ¸ãã¦ã¿ãã Reverse Polish notation calculator Groovy def solveRPN(expr) { expr.tokenize().inject([]){ acc, v -> "*" == v ? [acc[1] * acc[0]â¦
ãããã Haskell ã®æ¬ãåºçãããã®ã§å¾©ç¿ããã ãããã°ã©ãã³ã° Haskellã ã®ç¬¬8ç« ãä»å㯠Scala(version 2.9.2) ã§æ¸ããScala çã«ä½¿ã£ãæ¹ããããããã®ã§ Option ã Either ãåå¼·ããã Scala ã® API ã¨ä»¥ä¸ãåèã«ããªããæ¸ãã¦ã¿ãã Java â¦
Clojure ç·¨ã«ã¤ã¥ã Scala 編㸠Scala 㯠Haskell ã®å¤ãã®é¢æ°ãç¨æããã¦ããã®ã§ Haskell ããã®æ¸ãæããã®ã«ã¯æå©ã ã def makePair [T](xs: Seq[Seq[T]]) = xs zip xs.tail def comlen [T](p: (Seq[T],Seq[T])) = p.zipped takeWhile(x => x._1 == â¦
id:akihiro4chawon æ°ã® scala ãå·¦å¾åããã話 - akihiro4chawonã®æ¥è¨ ãå ãã¿ Pattern match*1 ã§è§£ãã¦ã¿ãã Pattern match ã¯å¥½ããªã®ã ã RWH ã«ããã¨æ示çãªå帰ãã fold ã使ãæ¹ãããããããã¨æ¸ãã¦ãã£ãããã®è¾ºãã¯çµé¨ãç©ãã§ããå¤â¦
id:akihiro4chawon æ°ã®ã¨ã³ããªã® 1ã¤ç®ã®å®è£ ãè¦ã¦ Haskell ã®å®è£ ã¨åãã ã£ãã®ã§é©ããã ã¹ã¯ãªãã㧠Haskell ã¨åãããã«æ¸ãç´ãã¦ã¿ãã val hamming: Stream[BigInt] = BigInt(1) #:: merge(merge(hamming map {_ * 2}, hamming map {_ * 3}), â¦