Last active
July 20, 2017 19:40
-
-
Save deque-blog/c1197ad34c943fc6f29122d8da58de25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
||| Given a predicate of type (a -> Bool), it transforms: | |
||| - a step function taking values of type `a` | |
||| - into one taking the values of type `a` that fulfills the predicate | |
filtering : (a -> Bool) -> Transducer acc s s a a | |
filtering pf = statelessTransducer $ | |
\next, acc, a => | |
if pf a | |
then next acc a | |
else pure (Continue acc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment