-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix the molding functions #1162
Conversation
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'm too smol brain to understand this code but the tests for this command seem to pass so LGTM
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.
this does not work. say, try molding [4,5,6]
to [[1,[2],[]],[[3]]]
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.
you could copy this from jelly. it's just 9 lines https://github.com/DennisMitchell/jellylanguage/blob/master/jelly/interpreter.py#L578-L586
Mutability and lazylists say otherwise. |
Wasn't it already copied from Jelly and then modified? |
That's right. In theory, it should still be the same(ish) algorithm just better suited for LazyLists and immutability. |
Goes towards closing #1119
break | ||
temp.append(obj) | ||
if type(_) in [list, LazyList]: | ||
temp = mold(content[: len(_)], _) |
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.
Should this not be recursing mold_without_repeat?
@@ -653,23 +653,29 @@ def mold( | |||
The content, molded into the shape. | |||
""" | |||
final = [] | |||
original, content = itertools.tee(content) | |||
original, content = map(LazyList, itertools.tee(content)) |
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.
This will only map at depth 1.
Replaced by #1167 |
Goes towards closing #1119