Skip to content

Instantly share code, notes, and snippets.

@kaveet
Last active November 24, 2016 18:22
Show Gist options
  • Save kaveet/a397dab4d01ddd9e692a4d1470d83ced to your computer and use it in GitHub Desktop.
Save kaveet/a397dab4d01ddd9e692a4d1470d83ced to your computer and use it in GitHub Desktop.
Haskell filter implementation with foldr
-- Problem 2: Write a function `filter'` that mimics the functionality of `filter` from the standard prelude, making use of `foldr`
module MyFilter where
filter' p = foldr (\x xs -> if p x then x : xs else xs) []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment