Last active
August 6, 2018 07:44
-
-
Save anirudh-eka/9c8efe1e73251625b16b2e9714acf721 to your computer and use it in GitHub Desktop.
Revisions
-
anirudh-eka revised this gist
Aug 6, 2018 . 1 changed file with 4 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 @@ -9,4 +9,7 @@ const filtering = filterLogic => reducer => (a, x) => { } else { return a; } } const trance = compose([filtering(x => x > 2), mapping(x => x + 1)]); [1, 2, 3].reduce(trance((a, x) => a.concat(x)), []); -
anirudh-eka created this gist
Aug 6, 2018 .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,12 @@ const mapping = mapLogic => reducer => (a, x) => { const transformed = mapLogic(x); return reducer(a, transformed) } const filtering = filterLogic => reducer => (a, x) => { if(filterLogic(x)) { return reducer(a, x) } else { return a; } }