Upcoming SlideShare
×

1,484 views

Published on

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

Published in: Technology, Education
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,484
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
14
0
Likes
1
Embeds 0
No embeds

No notes for slide
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n

1. 1. haskell para pythonistas @andrewsmedina
2. 2. porque haskell?• puramente funcional• lazy• um novo paradigma de linguagem
4. 4. python>>> 2+1517
6. 6. pythondef dobro(numero): return numero + numero
7. 7. haskelldobro numero = numero + numero
8. 8. pythondef ﬁb(n): if n == 0: return 0 elif n == 1: return 1 else: return ﬁb(n-1) + ﬁb(n-2)
9. 9. haskellﬁb 0 = 0ﬁb 1 = 1ﬁb n = ﬁb (n-1) + ﬁb (n-2)
10. 10. python>>> lista = [1,2,3,4,5]>>> [numero*2 for numero in lista][2, 4, 6, 8, 10]
11. 11. haskellPrelude> let lista = [1,2,3,4,5]Prelude> [x*2 | x <- lista][2,4,6,8,10]
12. 12. python>>> lista = [1,2,3,4,5]>>> [numero*2 for numero in lista if numero%2][2, 6, 10]
13. 13. haskellPrelude> let lista = [1,2,3,4,5]Prelude> [numero*2 | numero <- lista, odd numero][2,6,10]
14. 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)]