3 ms·
What I like about pipes it that it allows two ways to write chains of function calls. For calls that are more branch-like, the nested structure of standard func
by isaacimagine 5y ago
What I like about pipes it that it allows two ways to write chains of function calls. For calls that are more branch-like, the nested structure of standard function calls makes the most sense to me:
article = create(author("John"), Page.article())
For cases where you're modifying data sequentially, the pipe structure makes it really easy to read:
5th_prime = 0.. | filter(is_prime) | nth(5)
Having a way to write function calls forwards and backwards lets you choose whatever syntax feels most appropriate for the job.