nevalang / neva

🌊 Flow-based programming language with static types and implicit parallelism. Compiles to native code and Go
https://nevalang.org
MIT License
85 stars 7 forks source link

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

Closed Catya3 closed 2 weeks ago

Catya3 commented 2 weeks ago

Removes built-in Index

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

Catya3 commented 2 weeks ago

I realized we have lists.Index already

Catya3 commented 2 weeks ago

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