!SLIDE
!SLIDE
!SLIDE
YコンビネータLLC(Y Combinator LLC)は、カリフォルニア州マウンテンビューのベンチャーキャピタルである。
| import Data.Char | |
| euler16 = sum . (map digitToInt) . show | |
| main = print $ euler16 (2 ^ 1000) |
| def pascal1(c: Int, r: Int): Int = { | |
| if (c == 0 || c == r) 1 | |
| else pascal1(c - 1, r - 1) + pascal1(c, r - 1) | |
| } | |
| def pascal2(c: Int, r: Int): Int = { | |
| @tailrec | |
| def pascal(n: Int, prev: List[Int]): Int = { | |
| val row = (0 :: prev).zipAll(prev, 0, 0).map(t => t._1 + t._2) |
| module Main | |
| data FizzBuzz : (n: Nat) -> Type where | |
| Zero : FizzBuzz n | |
| Fizz : FizzBuzz n | |
| Buzz : FizzBuzz n | |
| Woof : FizzBuzz n | |
| Comb : FizzBuzz n -> FizzBuzz n -> FizzBuzz n | |
| instance Semigroup (FizzBuzz n) where |
| declare | |
| fun {Fact N} | |
| if N == 0 then 1 else N * {Fact N - 1} end | |
| end | |
| declare | |
| fun {AddList L1 L2} | |
| case L1 of H1 | T1 then | |
| case L2 of H2 | T2 then | |
| H1 + H2 | {AddList T1 T2} |
| module Monad where | |
| import Prelude hiding (fmap, Functor, Monad) | |
| class Functor f where | |
| fmap :: (a -> b) -> f a -> f b | |
| class Functor m => Applicative m where |
| class Num | |
| def initialize(v) | |
| @v = v | |
| end | |
| def combine(target) | |
| target | |
| end | |
| end |