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

Exercises for #48in24 #555

Open
11 tasks
siebenschlaefer opened this issue Jan 22, 2024 · 2 comments
Open
11 tasks

Exercises for #48in24 #555

siebenschlaefer opened this issue Jan 22, 2024 · 2 comments

Comments

@siebenschlaefer
Copy link

siebenschlaefer commented Jan 22, 2024

Dear maintainers,

Jeremy posted an overview of the exercises that will be featured in #48in24:
http://forum.exercism.org/t/which-exercises-for-48in24/8970/19

The following featured exercises have not been translated to Nim yet:

I'm posting them here as a reminder.
I hope I will find the time to translate a few of them (although I'm rather a beginner in Nim), and perhaps others will help, too.
Feel free to close or remove this issue if you do not find it helpful.

Edit:
There is now a dedicated matrix with the status of all exercises in #48in24, which tracks have implemented them, and which exercises are featured on a specific track:
https://exercism.org/challenges/48in24/implementation_status

@siebenschlaefer
Copy link
Author

I want to translate two-bucket. In fact, the translation is almost finished, there's just one thing where I could use some input.

There are two types of test cases:

  • "possible" test cases where the function should return the number of moves, the bucket that contains the goal volume, and the volume of the other bucket.
  • "impossible" test cases where no sequence of moves can produce the goal volume and therefore some sort of "error" is expected.

What should that error be?

  • The tuple that the function returns could contain a field possible that is false for impossible cases.
  • The function could throw an exception (but which one?)
  • The function could return an Option

What do you think is the best option?

@ynfle
Copy link
Contributor

ynfle commented Feb 4, 2024

I want to translate two-bucket. In fact, the translation is almost finished, there's just one thing where I could use some input.

There are two types of test cases:

* "possible" test cases where the function should return the number of moves, the bucket that contains the goal volume, and the volume of the other bucket.

* "impossible" test cases where no sequence of moves can produce the goal volume and therefore some sort of "error" is expected.

What should that error be?

* The tuple that the function returns could contain a field `possible` that is `false` for impossible cases.

* The function could throw an exception (but which one?)

* The function could return an `Option`

What do you think is the best option?

Here are my thoughts:

  • The first option is a little tricky because some info is lost in the type. An object variant would be a good alternative here, in my opinion
  • We could define our own exception and check that it is raised
  • I don't think Option is useful here as that None case doesn't really give any information. This definitely could make sense, though

It depends both on preference and what we are trying to convey. The object variant says that there are 2 possibilities and the exception and Option say that something "went wrong". In addition, exception says that something "exceptional" is going on while option says "it may not work out".

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

No branches or pull requests

2 participants