From ad05f12f2bf44a85693121182a2593c3f780a7d8 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Sun, 24 Aug 2025 21:00:07 +0200 Subject: improve the solution for exercise 2 --- lec06/Fibonacci.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lec06/Fibonacci.hs') 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) -- cgit v1.2.3