-
Notifications
You must be signed in to change notification settings - Fork 90
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 stdlib function array.at_or #1927
Conversation
core/stdlib/std.ncl
Outdated
std.array.at 3 "default" [ "zero", "one" ] => | ||
"default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at
-> at_or
+ adding an example where the default value isn't chosen.
std.array.at 3 "default" [ "zero", "one" ] => | |
"default" | |
std.array.at_or 3 "default" ["zero", "one", "two", "three"] => | |
"three" | |
std.array.at_or 3 "default" ["zero", "one"] => | |
"default" |
0fa132d
to
51ba172
Compare
This is to return value at given position of array or default in case provided position is out of bound. Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
6a08716
to
db42b47
Compare
@olorin37 those line numbers in tests are a bit annoying. You need to run |
Yep, I already figure out staff relatet to |
Hmm, i see that those line numbers still visible in check on CI... Locally I've already solve this ... Maybe I forgot to push last changes, as I hit next problem, but it would be strange... As I feel that I pushed those insta review changes... Maybe there is a diff between my env and CI which causes this, I'll try align CI to my env... |
It's probably the same problem, but for manual snippets. The CI tests all manual snippets as well, including their output - for now it's not smart enough to strip unimportant information like line numbers. So changing the stdlib can always be a bit painful on that front, if you shuffle line numbers, you have to fix the corresponding excerpt which includes full error messages in the manual. Hopefully the error message should give you the diff of what line number you need to change. Long term, it would probably be nicer to just strip stdlib line numbers from the output - we already do something similar in snapshots test to strip the local file paths from error snapshots. |
I got following error:
|
@yannham OK, so now on CI you can see same problem which I have. I do not know why filter function somewhere is broken now? |
The |
Nice, OK. So, how to change those line numbers? Because |
For the manual I think you need to change them manually, they don't go via |
Ok, Ill try:) |
5f31ce5
to
9e407ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
This is to return value at given position of array or default in case provided position is out of bound.