| 590 | self.expr = expr # pyll graph defining this Lambda |
| 591 | |
| 592 | def __call__(self, *args, **kwargs): |
| 593 | # -- return `expr` cloned from given args and kwargs |
| 594 | if len(args) > len(self.params): |
| 595 | raise TypeError("too many arguments") |
| 596 | memo = {} |
| 597 | for arg, param in zip(args, self.params): |
| 598 | # print('applying with arg', param, arg) |
| 599 | memo[param[1]] = as_apply(arg) |
| 600 | if len(args) != len(self.params) or kwargs: |
| 601 | raise NotImplementedError("named / default arguments", (args, self.params)) |
| 602 | rval = clone(self.expr, memo) |
| 603 | return rval |
| 604 | |
| 605 | |
| 606 | class UndefinedValue: |