Created
March 2, 2017 04:33
-
-
Save ccorcos/cd1467f6f27eb088d3b9aad83918f607 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
const char = c => input => { | |
if (input[0] === c) { | |
return {success: true, rest: input.slice(1)} | |
} | |
return {success: false, rest: input} | |
} | |
char('a')('abc') | |
// => { success: true, rest: 'bc' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment