summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-24 21:00:07 +0200
committerEdoardo La Greca2025-08-24 21:20:34 +0200
commitad05f12f2bf44a85693121182a2593c3f780a7d8 (patch)
treebf0b8342717de55823858f496d1416895fc00420
parentf026b40ca1919a36f662b74d754e548e42965469 (diff)
improve the solution for exercise 2
-rw-r--r--lec06/Fibonacci.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/lec06/Fibonacci.hs b/lec06/Fibonacci.hs
index 79f888e..5d5eb00 100644
--- a/lec06/Fibonacci.hs
+++ b/lec06/Fibonacci.hs
@@ -11,5 +11,5 @@ fibs1 = map fib [0..]
-- Exercise 2
fibs2 :: [Integer]
-fibs2 = 0 : (map last $ iterate (\l -> [ last l , last l + (last . init) l ]) [0,1])
+fibs2 = map fst $ iterate (\l -> ( snd l , snd l + fst l )) (0,1)