From 0d10b10425cb6a0306a8938b9ffd60226b4d9c65 Mon Sep 17 00:00:00 2001 From: Evan Hock Date: Sun, 8 Dec 2024 23:14:54 -0800 Subject: [PATCH] Added a mention of filter --- haskell.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/haskell.md b/haskell.md index 696a82fb..80a7be0c 100644 --- a/haskell.md +++ b/haskell.md @@ -282,6 +282,9 @@ for [0..5] $ \i -> show i -- we could've written that like this too: for [0..5] show +-- filter keeps only the elements in a list that satisfy a condition +filter even [1..10] -- [2, 4, 8, 10] + -- You can use foldl or foldr to reduce a list -- foldl foldl (\x y -> 2*x + y) 4 [1,2,3] -- 43