Created
May 15, 2020 16:41
-
-
Save fjpse/ff99238b89f043e6df39dc69d029f614 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
-module(lst). | |
-export([ | |
take/2, | |
]). | |
%% | |
%% take(N, L) -> returns the N first elements of the list L | |
%% | |
take(0, _L) -> []; | |
take(_N, []) -> []; | |
take(N, [X|Xs]) when is_integer(N) andalso N > 0 -> | |
[X | take(N-1, Xs)]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment