Last active
December 12, 2015 07:03
-
-
Save manuphatak/03e3497a64988cb6ebd5 to your computer and use it in GitHub Desktop.
Revisions
-
manuphatak revised this gist
Dec 12, 2015 . No changes.There are no files selected for viewing
-
manuphatak revised this gist
Dec 12, 2015 . 1 changed file with 10 additions and 11 deletions.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 @@ -3,22 +3,21 @@ def pipeline(steps, initial=None): def apply(result, step): yield from step(result) yield from reduce(apply, steps, initial) if __name__ == '__main__': # BEFORE before = notify(write(modify(sanitize(concat(read(FILES)))))) # AFTER process = read, concat, sanitize, modify, write, notify after = pipeline(process, FILES) # alternate, BEFORE opened_files = read(FILES) meaningless_variable_name = concat(opened_files) etc = sanitize(meaningless_variable_name) step4 = modify(etc) step5 = write(step4) before = notify(step5) -
manuphatak revised this gist
Dec 12, 2015 . 1 changed file with 13 additions and 5 deletions.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 @@ -7,10 +7,18 @@ def apply(result, step): yield from reduce(apply, steps, initial) if __name__ == '__main__': # BEFORE before = notify(write(modify(sanitize(concat(read(FILES)))))) # or, BEFORE step1 = read(FILES) step2 = concat(step1) step3 = sanitize(step2) step4 = modify(step3) step5 = write(step4) before = notify(step5) # AFTER process = read, concat, sanitize, modify, write, notify after = pipeline(process, FILES)
-
manuphatak revised this gist
Dec 12, 2015 . 1 changed file with 2 additions and 2 deletions.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 @@ -1,10 +1,10 @@ from functools import reduce def pipeline(steps, initial=None): def apply(result, step): yield from step(result) yield from reduce(apply, steps, initial) if __name__ == '__main__': # BEFORE -
manuphatak created this gist
Dec 12, 2015 .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,16 @@ from functools import reduce def pipeline(process, initial=None): def apply(result, step): yield from step(result) yield from reduce(apply, process, initial) if __name__ == '__main__': # BEFORE before = notify(write(modify(sanitize(concat(read(FILES)))))) # AFTER process = read, concat, sanitize, modify, write, notify after = pipeline(process, FILES)