-
Notifications
You must be signed in to change notification settings - Fork 171
Implement other List methods #941
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
Comments
Yes, we should implement all these. Given the requirement for list to work for all types, it might be easier to just implement in the backend directly, until we have working generics. |
Other operations that we can think about adding later, taken from std::vector (once we have a C++ frontend, we'll need these):
Also in order for our ASR |
Do you mean possibly adding an ASR node for each method? |
That path is clear and we might start with that. I am hoping to keep the ASR minimal, but we can I think figure it out later how to implement some of this functionality another way. |
Hmm... It's still not clear to me what we really want.
If you want the ASR to be minimal and not have frontend-specific nodes, then shouldn't we focus on the runtime library (or possibly explore another option)? |
Yes, it's not clear either to me. I am hoping to avoid having 200 such functions in ASR. I think what we need is to figure out which of these can be implemented in the runtime library, and if they can, we should. If they can't, then they should be part of ASR. |
Here’s what I think, So only 2 (at max) out of the above need backend implementation. Rest can go into frontend with the help of generics. Now implementing all of these in backend via ASR nodes will be very redundant and pollution of ASR. |
Alright, then I agree it's better to wait until we have working generics. |
I would prioritise options as follows,
So all in all, list features can be done either via frontend implementation or via backend implementation. Other options aren’t required to be considered IMO. |
Hey! I am interested in working on this issue, can I get some help on how to start and exactly how to implement this? |
class List:
Note that this implementation does not use any built-in Python methods for simplicity. Also note that this implementation assumes the list only contains items of the same type. If you want to support lists of lists or tuples with lists, you may need to modify the code accordingly. |
Currently we support: append(), insert(), remove() and pop().
TODO:
Source: https://docs.python.org/3/tutorial/datastructures.html#more-on-lists
The text was updated successfully, but these errors were encountered: