New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tail recursion to IR #5228
Add tail recursion to IR #5228
Conversation
3807286
to
8eb913b
Compare
Spun the wheel got Patrick, would also like @cseed, @tpoterba, @catoverdrive to look if they have time. Thanks! |
@patrick-schultz ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we continue to talk offline about the high level design, here are the minor nits I have so far.
@typecheck(recur_exprs=expr_any) | ||
def make_loop(*recur_exprs): | ||
if len(recur_exprs) != len(exprs): | ||
raise TypeError('loop and recursion must have the same number of arguments') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably make this "Recursive call in loop has wrong number of arguments", and below something like "Type error in recursive call:"
Returns | ||
------- | ||
:class:`.Expression` | ||
Result of the loop with `exprs` as inital loop values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"initial"
|
||
for expr in exprs: | ||
uid = Env.get_uid() | ||
args.append(construct_variable(uid, expr._type, expr._indices, expr._aggregations)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find args
confusing. How about loop_vars
?
This includes * Python classes * Parsing * Interpret TODOs: * Emit * C++ Emit
Also fix some type inferences in Loop and Recur This iteration currently requires `loop` to take its return type as an argument.
This fundamentally needs to be rewritten now. I'll be able to fix all the merge conflicts, but it's probably better as a new PR. |
There is still work to do here, but it is now complete enough that InterpretSuite can be run properly on a minimal example.
Current TODOs:
Loop
and matchingRecur
Loop
and matchingRecur