(blog ‘lucindo)

um dia eu aprendo a programar

Iniciação Haskell

Seguindo instruções do Herrmann..

algor:~ lucindo$ ghci
   ___         ___ _
  / _  /  // __(_)
 / /_// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\/ __  / /___| |      http://www.haskell.org/ghc/
____// /_/____/|_|      Type : ? for help.

Loading package base ... linking ... done.
Prelude> let fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
Prelude> take 10 fibs
[1,1,2,3,5,8,13,21,34,55]
Prelude> zip [1..] "lisp"
[(1,'l'),(2,'i'),(3,'s'),(4,'p')]
Prelude>

Achei muito doce.



 | Enviar por e-mail  | Hits para esta publicação: 606

Deixe uma resposta.