Created
January 31, 2019 15:46
-
-
Save loicdescotte/96979aa6c8c92a264c8c5faeaa25b37e to your computer and use it in GitHub Desktop.
ReasonML : drop element in list
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
let dropListElement = (n, list) => { | |
let rec aux = (i, list) => | |
switch list { | |
| [] => [] | |
| [x, ...xs] => i == n ? xs : [x, ...aux(i + 1, xs)] | |
}; | |
aux(0, list); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment