Mercerenies / alakazam

Functional programming sugar for Python
Other
2 stars 0 forks source link

Some way to construct tuples with anonymous instances #3

Open Mercerenies opened 6 years ago

Mercerenies commented 6 years ago

This doesn't work

zz.map((_1, _2))

since the tuple construction syntax can't be overridden. Perhaps we should define a function that has the intended behavior here.

zz.map(zz.tup(_1, _2))

Possible implementation:

def tup(*args):
    def constr(*iargs):
        return iargs
    return zz.bind(constr)(*args)