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

Add yacht exercise #691

Merged
merged 6 commits into from
Dec 26, 2024
Merged

Add yacht exercise #691

merged 6 commits into from
Dec 26, 2024

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Nov 13, 2024

No description provided.

@m-dango
Copy link
Member

m-dango commented Nov 18, 2024

I want to have a think about this one for the categories arg, wondering if there's a better option than a string (thinking about how its done in Raku and Python)

@kotp kotp marked this pull request as draft November 18, 2024 16:59
@glennj
Copy link
Contributor Author

glennj commented Nov 18, 2024

Perhaps something like

package Yacht::Categories;

# exports ...

use constant {
    ONES => 1,
    TWOS => 2,
    # ...
    CHOICE => 12,
};

Or, do away with the category argument, and the generator calls a subroutine named after the category:

subs: ones twos ... choice
properties:
   score:
     test: |-
       use Data::Dmp;
       (my $name = $case->{input}{category}) =~ s/ /_/g;
       sprintf(<<'END', $name, dmp($case->{input}{dice}), $case->{expected}, dmp($case->{description}));
       is(
           %s(%s),
           %s,
           %s,
       );
       END

@glennj
Copy link
Contributor Author

glennj commented Dec 9, 2024

@m-dango I added a Category submodule with Readonly values for the categories.

This is a bit awkward, as there's no way to stash it in the template-data.yaml file.

@glennj glennj marked this pull request as ready for review December 9, 2024 20:18
Comment on lines +18 to +20
"editor": [
"lib/Yacht/Category.pm"
]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this. This makes the Category module visible in the web editor, but readonly.

@kotp kotp merged commit 5964ce3 into exercism:main Dec 26, 2024
19 checks passed
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.

3 participants