Created
May 17, 2020 03:46
-
-
Save sushant12/237fd082e77d1f6edec0099e6736d4e3 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(list). | |
-export([take/2]). | |
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