Last active
September 11, 2020 16:01
-
-
Save lumixraku/cb75e091b9e16e41acc6cdd919060665 to your computer and use it in GitHub Desktop.
Revisions
-
lumixraku revised this gist
Sep 11, 2020 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,8 @@ const curring = fn => { const listMerge = (a, b, c) => [a, b, c] const curried = curring(listMerge) console.log(curried(1)(2)(3)) // [1, 2, 3] console.log(curried(1, 2)(3)) // [1, 2, 3] console.log(curried(1, 2, 3)) // [1, 2, 3] -
lumixraku created this gist
Sep 11, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ const curring = fn => { const { length } = fn const curried = (...args) => { return (args.length >= length ? fn(...args) : (...args2) => curried(...args.concat(args2))) } return curried } const listMerge = (a, b, c) => [a, b, c] const curried = curring(listMerge) console.log(curried(1)(2)(3)) // [1, 2, 3]