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

refactor: non optional nth on Array and Vector #7526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stetimi
Copy link
Contributor

@stetimi stetimi commented Apr 1, 2024

Adding nth + IndexOutOfBounds effect, just on Array and Vector (I prefer to do it incrementally if that's acceptable).

main/src/library/Array.flix Outdated Show resolved Hide resolved
@stetimi stetimi force-pushed the nth-on-array branch 2 times, most recently from f42415d to 1a478c6 Compare April 1, 2024 13:24
@stetimi stetimi changed the title non optional nth on Array and Vector refactor: non optional nth on Array and Vector Apr 1, 2024
@stetimi
Copy link
Contributor Author

stetimi commented Apr 1, 2024

@mlutze ready to review I think

main/src/library/Array.flix Outdated Show resolved Hide resolved
main/src/library/Vector.flix Outdated Show resolved Hide resolved
@magnus-madsen
Copy link
Member

Hi. I am a bit busy at the moment, but I will try to get around to it. Also just FYI: We may not be able to merge this in until there is a bit more progress on the effect side.

@stetimi
Copy link
Contributor Author

stetimi commented Apr 2, 2024

Hi. I am a bit busy at the moment, but I will try to get around to it. Also just FYI: We may not be able to merge this in until there is a bit more progress on the effect side.

Understood, I will park this for now.

@magnus-madsen
Copy link
Member

Why is there a file called ^1 included? :)

@stetimi
Copy link
Contributor Author

stetimi commented Apr 2, 2024

Why is there a file called ^1 included? :)

A mistake - deleted, and fixed up the other comments too (thanks!)

Copy link
Member

@magnus-madsen magnus-madsen left a comment

Choose a reason for hiding this comment

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

OK. I did a detailed review. If you fix these things I think its good to go.

main/src/library/MutDeque.flix Outdated Show resolved Hide resolved
main/src/library/MutList.flix Show resolved Hide resolved
main/src/library/Vector.flix Show resolved Hide resolved
main/src/library/Vector.flix Show resolved Hide resolved
main/test/ca/uwaterloo/flix/library/TestArray.flix Outdated Show resolved Hide resolved
main/test/ca/uwaterloo/flix/library/TestArray.flix Outdated Show resolved Hide resolved
main/test/ca/uwaterloo/flix/library/TestVector.flix Outdated Show resolved Hide resolved
main/test/ca/uwaterloo/flix/library/TestVector.flix Outdated Show resolved Hide resolved
@magnus-madsen
Copy link
Member

@stetimi Could you mark the comments as resolved, if they are indeed resolved :)

@stetimi
Copy link
Contributor Author

stetimi commented Apr 3, 2024 via email

@stetimi
Copy link
Contributor Author

stetimi commented Apr 4, 2024

@stetimi Could you mark the comments as resolved, if they are indeed resolved :)

Done

@@ -454,7 +454,7 @@ mod Test.Exp.Regions {
MutList.push!(1, l);
MutMap.put!(1, l, Array.get(0, a));
match MutMap.get(1, Array.get(0, a)) {
case Some(k) => MutList.nth(0, k) == Some(1)
case Some(k) => optionalNth(0, k) == Some(1)
Copy link
Member

Choose a reason for hiding this comment

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

These are just test cases, so I think we should just use get and avoid all the optionalNth stuff!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no get in MutList. Should I:

  1. add it and delegate down to Array.get
  2. use nth and put try..with statements around the relevant tests?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. Not sure, let me get back to you.

@magnus-madsen
Copy link
Member

I added one comment about simplifying the test cases. Once that is done, I will let @mlutze have a look and we can probably merge.

He also needs to fix one of his projects before the merge.

Thanks!

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.

None yet

3 participants