Open suned opened 4 years ago
A mappable type is something that implemets __map__(self, f). A chainable type is something that implements __chain__(self, f).
mappable
__map__(self, f)
chainable
__chain__(self, f)
A type T that implements both can be used in do expressions as
T
do
fullname = do user_id('sad') as uid, first_name(uid) as first, last_name(uid) as last in f'{first} {last}'
Which will translate to
fullname = user_id('sad').__chain__(lambda uid: first_name(uid).__chain__(lambda first: last_name(uid).__map__(lambda last: f'{first} {last}')))
A
mappable
type is something that implemets__map__(self, f)
. Achainable
type is something that implements__chain__(self, f)
.A type
T
that implements both can be used indo
expressions asWhich will translate to