Hey,
I'm trying to make the accumulator argument, k, in the simple factorial example implicit by using it as a keyword argument like so:
@with_continuations()
def factorial_kw(n, k=1, self=None):
return self(n-1, k=n*k) if n > 1 else k
print(factorial_kw(10))
However, this results in the following error:
Traceback (most recent call last):
File "./test.py", line 12, in <module>
print(factorial_kw(10))
File "/usr/local/lib/python3.6/dist-packages/tco/__init__.py", line 41, in __call__
return f(*args)
File "/usr/local/lib/python3.6/dist-packages/tco/__init__.py", line 86, in <lambda>
f(*args, self=kself, **dict(zip(keys, conts)))) (*k)
File "./test.py", line 11, in factorial_kw
return self(n-1, k=n*k) if n > 1 else k
TypeError: t() got an unexpected keyword argument 'k'
Not sure whether this is expected or if it's a bug, so I figured I'd submit an issue.
Hey,
I'm trying to make the accumulator argument,
k, in the simple factorial example implicit by using it as a keyword argument like so:However, this results in the following error:
Not sure whether this is expected or if it's a bug, so I figured I'd submit an issue.