Created
July 12, 2021 18:13
-
-
Save sergioatanacio/98cc3bc84593b9d6cc542ed2294f3785 to your computer and use it in GitHub Desktop.
Aprendiendo programación funcional con javascript y php. https://youtu.be/0pzkuQ3q8t8?t=1042
This file contains hidden or 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
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf8'); | |
| const uno = (dos) => { | |
| return (tres) => { | |
| return dos + tres; | |
| } | |
| } | |
| const cuatro = (seis) => { | |
| return uno(3)(seis); | |
| } | |
| console.log(cuatro(5)); |
This file contains hidden or 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 | |
| $uno = function($dos) | |
| { | |
| return function($tres) use ($dos) | |
| { | |
| return $tres + $dos; | |
| }; | |
| }; | |
| $cinco = function($seis) use ($uno) | |
| { | |
| return $uno(3)($seis); | |
| }; | |
| echo $cinco(4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment