Skip to content
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

implement arrays #6

Merged
merged 1 commit into from
Oct 11, 2024
Merged

implement arrays #6

merged 1 commit into from
Oct 11, 2024

Conversation

gschnabel
Copy link
Contributor

I've implemented simple array functionality and associated tests. Now syntax like x[3] or x[2][4] can be used for accessing elements in simple arrays and nested arrays, respectively.

Importantly, the underlying Python data type should be list so that it works as expected. Therefore, in contrast to numpy arrays, the shape of arrays can be irregular (e.g., different number of elements per row). I think this is a good choice if the central data structure we want to manipulate/transform is data in the JSON format, for which the definition of arrays mirrors the Python list data type.

Copy link
Contributor

@thomasms thomasms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. I just had a few small comments.

I also tried _parse_and_assert("[1,4,1,1,-9]", [1,4,1,1,-9]) as a test but I guess this only does array evaluation, and does not support hard coded arrays.

src/larktools/evaluation.py Show resolved Hide resolved
src/larktools/evaluation.py Show resolved Hide resolved
@julia-sprenger julia-sprenger mentioned this pull request Oct 10, 2024
12 tasks
@gschnabel gschnabel merged commit 1270582 into main Oct 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants