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(secret-handshake): overhaul to use enum #537

Merged
merged 9 commits into from
Oct 2, 2023

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Sep 23, 2023

This exercise has always (8015636) required the user to return seq[string], but the scenario is better modelled with an enum.

This PR is similar to previous overhauls for allergies (a8ab9c8) and space-age (b770d96).

Closes: #536


To-do:

  • Consider changing Signal to Action, to better match the docs. An argument for Signal is that it allows the user to more cleanly add Reverse, which isn't exactly an "action".

This exercise has always [1] required the user to return seq[string],
but the scenario is better modelled with an enum.

This commit is similar to previous overhauls for the allergies [2] and
space-age [3] exercises.

Closes: exercism#536

[1] 8015636, 2019-02-24, "Adds secret-handshake exercise"
[2] a8ab9c8, 2023-01-11, "exercises(allergies): overhaul to use enum"
[3] b770d96, 2023-01-11, "exercises(space-age): overhaul to use enum"
@ee7 ee7 requested a review from ynfle September 23, 2023 15:30
@ee7 ee7 force-pushed the exercise-secret-handshake-enum branch from ed49d49 to 07098a6 Compare September 23, 2023 15:46
Similar to previous discussions [1] I probably have a small preference
for using shifts here, but it's fine either way.

Note that bitops2 calls this `getBit` [2].

[1] exercism#434 (comment)
[2] https://github.com/status-im/nim-stew/blob/3159137d9a31/stew/bitops2.nim#L420-L424

Suggested-by: ynfle
This better supports adding new enum values, as long as those values
aren't "special" like Reverse.
@ee7 ee7 requested a review from ynfle October 2, 2023 09:04
@ee7 ee7 merged commit 81d1c6c into exercism:main Oct 2, 2023
10 checks passed
@ee7 ee7 deleted the exercise-secret-handshake-enum branch October 2, 2023 18:29
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.

exercises(secret-handshake): should return a seq of an enum, not seq[string]
2 participants