Created
July 24, 2017 13:22
-
-
Save memclutter/27c82dec2a3a409f11054ea893a688e4 to your computer and use it in GitHub Desktop.
Implementation of the filter function
This file contains hidden or 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
| -module(myfilter). | |
| -export([filter/2]). | |
| % Implementation of the filter function | |
| filter(P, [H|T]) -> | |
| case P(H) of | |
| true -> [H|filter(P, T)]; | |
| false -> filter(P, T) | |
| end; | |
| filter(_, []) -> []. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment