Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TRIÁNGULO DE PASCAL - HASKELL
- --Moy Kusanagi
- --El rincón de los gordos frikis
- --Dado n ∊ ℕ, la función nos regresa el n-simo renglón del
- --triángulo de Pascal.
- pascal :: Int -> [Int]
- pascal 1 = [1]
- pascal 2 = [1,1]
- pascal n = [1] ++ (sumPares (pascal (n-1))) ++ [1] where
- sumPares [x,y] = [x+y]
- sumPares (x:(y:ys)) = (x+y):(sumPares (y:ys))
Advertisement
Add Comment
Please, Sign In to add comment