4 ms·
The example I gave was contrived. I frequently find myself modeling much of my logic as a series of data transformations. The more I can model logic like this,
by neurotrace 5y ago
The example I gave was contrived. I frequently find myself modeling much of my logic as a series of data transformations. The more I can model logic like this, the easier it is to test.
For what it's worth, your example doesn't map 1-to-1 to the intention of what I wrote. Doing it in a more imperative style, I'd have to write
emails = list()
for user in users:
emails.push(user.email)
res = sendEmail emails
if res.IsError:
Error("Error sending emails")
else:
res
(excuse my pseudo Python)
- BiteCode_dev 5y agoExcuses accepted. Imperative Python would really look like: try: return sendEmail(user.email for user in users) except IsError: Error("Error sending emails") # if it does something I agree FP pipelines are nice, but not everything needs it.