Last active
March 4, 2019 16:52
-
-
Save jamierumbelow/220ee7eea6629765f84d6058a1139b19 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
<?php | |
// ltr | |
$curriedStrpos = curry('strpos', 'haystack'); | |
$this->assertEquals(1, $curriedStrpos('a')); | |
$this->assertEquals(4, $curriedStrpos('t')); | |
// rtl | |
$curriedSubstr = curryFromRight('substr', 0, 1); | |
$this->assertEquals([ 'a', 'b', 'c' ], | |
collect([ 'anything', 'but', 'chardonnay' ])->map($curriedSubstr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment