Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #not idiomatic but shows that the value is encapsulated in a container that provides extra context used by bind()
- Class Option
- Def __init__(self, x):
- Self.x=x
- Def is_none(self):
- Return self.x is None
- Def bind(val, f):
- If val.is_none():
- # ignore the remainder of the program and return early
- Return None
- Else:
- Return f(val.x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement