-
Notifications
You must be signed in to change notification settings - Fork 81
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 base array function to std #216
Add base array function to std #216
Conversation
that's essentially a wrapper for also every stdlib function should be covered by a test (see #127) |
compared to : and is permit more complex code like :
it's just palliative |
and sorry for the test, I did not see. |
I am not a Rust specialist,
|
@b1ek The problem is that Amber has implemented subscript syntax just for variables only. The reason is that back then array literals were literally evaluated as literals |
just push the commit and i will approve it if its good, and request changes if its not |
@CymDeveloppement any progress on this? |
@b1ek pull request is updated with the commit, |
return -1 if value not present in array
tbh i agree with @Mte90, function names are important since they will stay as is. what about renaming |
Maybe : |
the |
* Add array_value function * Add array_index function * Add array_search function * test for new array function * add return value in array_index function return -1 if value not present in array * in_array test function * array_value rename to array_get * arry_index rename to array_first_index * remove array_get function
An user reported that is missing a function to get the length of the array |
@Mte90 there is such function: |
array_value(array, index)
return the value at index
array_index(array, value): Num
search the first occurrence of value and return index
array_search(array, value): [Num]
return an array of Num with corresponding indexes