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

Add {lists,strings}.At flow ops to access elements of a List and runes in a string #679

Merged
merged 8 commits into from
Jun 15, 2024

Conversation

Catya3
Copy link
Collaborator

@Catya3 Catya3 commented Jun 11, 2024

Removes built-in Index

Needed for https://github.com/Catya3/mandelbrot

@Catya3 Catya3 force-pushed the lists-at branch 2 times, most recently from 0d6b3c6 to 80d35d4 Compare June 11, 2024 21:27
@Catya3 Catya3 closed this Jun 11, 2024
@Catya3 Catya3 deleted the lists-at branch June 11, 2024 22:21
@Catya3
Copy link
Collaborator Author

Catya3 commented Jun 11, 2024

I realized we have lists.Index already

@Catya3
Copy link
Collaborator Author

Catya3 commented Jun 11, 2024

Uhh we still need this. I don't believe Index works for me as the generic types are not exact.

// Index returns the element at the given index in the ordered collection.
// If the index is out of bounds, it returns an error.
// The index is zero-based.
#extern(index)
pub flow Index<T list<any> | string>(data T, idx int) (res T, err error)

res T is a list not an any or even $element_type

@Catya3 Catya3 restored the lists-at branch June 11, 2024 22:27
@Catya3 Catya3 reopened this Jun 11, 2024
@Catya3 Catya3 changed the title Add Lists.At flow op to access elements of a List Add {lists,strings}.At flow ops to access elements of a List and runes in a string Jun 12, 2024
@Catya3 Catya3 linked an issue Jun 12, 2024 that may be closed by this pull request
@emil14 emil14 merged commit a544152 into main Jun 15, 2024
1 of 2 checks passed
@emil14 emil14 deleted the lists-at branch June 15, 2024 18:13
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.

Index flow has a generic signature that doesn't make sense.
2 participants