(no title)
montebicyclelo | 4 months ago
bulk_send(
generate_expiry_email(user)
for user in db.getUsers()
if is_expired(user, date.now())
)
(...Just another flavour of syntax to look at)montebicyclelo | 4 months ago
bulk_send(
generate_expiry_email(user)
for user in db.getUsers()
if is_expired(user, date.now())
)
(...Just another flavour of syntax to look at)
whichdan|4 months ago
It just becomes so easy to incrementally add functionality here.
---
Quick syntax reference for anyone reading:
- Pipelines apply the previous result as the first argument of the next function
- The `/1` after a function name indicates the arity, since Elixir supports multiple dispatch
- `&fun/1` expands to `fn arg -> fun(arg) end`
- `&fun(&1, "something")` expands to `fn arg -> fun(arg, "something") end`
Akronymus|4 months ago
Writing custom monad syntax is definitely quite a nice benefit of functional languages IMO.