Your SlideShare is downloading. ×
Haskell para pythonistas
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Haskell para pythonistas

1,164
views

Published on

Palestra relâmpago apresentada o FISL12, mostrando semelhanças e diferenças entre python e haskell

Palestra relâmpago apresentada o FISL12, mostrando semelhanças e diferenças entre python e haskell

Published in: Technology, Education

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,164
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. haskell para pythonistas @andrewsmedina
    • 2. porque haskell?• puramente funcional• lazy• um novo paradigma de linguagem
    • 3. python x haskell• multi paradigma • funcional• dinâmica • estática• interpretada • compilada• recursao • recursao++
    • 4. python>>> 2+1517
    • 5. haskellPrelude> 2+1517
    • 6. pythondef dobro(numero): return numero + numero
    • 7. haskelldobro numero = numero + numero
    • 8. pythondef fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2)
    • 9. haskellfib 0 = 0fib 1 = 1fib n = fib (n-1) + fib (n-2)
    • 10. python>>> lista = [1,2,3,4,5]>>> [numero*2 for numero in lista][2, 4, 6, 8, 10]
    • 11. haskellPrelude> let lista = [1,2,3,4,5]Prelude> [x*2 | x <- lista][2,4,6,8,10]
    • 12. python>>> lista = [1,2,3,4,5]>>> [numero*2 for numero in lista if numero%2][2, 6, 10]
    • 13. haskellPrelude> let lista = [1,2,3,4,5]Prelude> [numero*2 | numero <- lista, odd numero][2,6,10]
    • 14. haskellPrelude> [ (a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2][(3,4,5),(6,8,10)]
    • 15. haskellPrelude> product [1..10]3628800
    • 16. haskellmain = do firstFactorOver(3)firstFactorOver n = head [trianguleNumber(x) | x <- [1..], length ( factorsOf ( trianguleNumber(x) ) ) > n ]trianguleNumber n = sum[1..n]factorsOf number = 1:[x| x <- [2..number], number `mod` x == 0] ++ [number]
    • 17. python funcional• itertools• list comprehensions• map, reduce, zip...
    • 18. como começar?• ghci
    • 19. http://learnyouahaskell.com