New exercise contributions

1 Like

It looks like the flatten-array exercise that is failing in the four unrelated exercise PRs is due to it being generated with an older raku. I imagine the updated docker produces different output so the source needs a rerun. A test PR with a refreshed run passes all tests for what that’s worth:

2 Likes
1 Like
2 Likes
1 Like
1 Like

Reopened, but still in draft.

Checks passed.
Ready for review – thanks @kotp !

1 Like

In order to remove the duplication of the grammar, class and subroutine in each property test case that needs it, we can adjust the raku Exercism generator to prepend common code:

raku / lib / Exercism / Generator.rakumod

# inside submethod build-property-tests, replace the EVAL line:
-      my @output = EVAL($eval).lines(:!chomp);
+      # Prepend shared test setup (from top-level 'tests' in template-data.yaml)
+      my $shared = self.data.<tests> // '';
+      my @output = EVAL( $shared ~ "\n" ~ $eval ).lines(:!chomp)

This was suggested by co-pilot and worked for me.
I’m unfamiliar with this code base and anything around an EVAL is enough to give me pause.

Happy to send in a PR if this sounds sound.
Thanks !

2 Likes

You can reveal the RFC (“request for comment” or “request for consideration”) branch if you submit it to your repository, for review as well, before you pull the trigger to create pull request.

Pause on “eval” related things is a good thing to do, but if you control all the inputs, it is less dangerous, since you would also be able to write the code yourself otherwise. So “not user supplied inputs” is probably one (very important) aspect to consider, otherwise “eval” is just another tool.

I can probably take a look sometime next week as I’m off work. The “tests” section predates the use of canonical data, but if I remember correctly there are some exercises which use it to prepend code before tests. It was never intended for repetition though.

It could be worth adding a case_prefix key rather than changing this?

2 Likes
1 Like
1 Like

I’m seeing a bug surface when trying to solve the Rational Numbers exercise in the online editor, namely:

No such method 'add' for invocant of type 'RationalNumbers'
  in block <unit> at /mnt/exercism-iteration/t/rational-numbers.rakutest line 13

?

Are you working on that in 268b3ef2 ?

It passes the tests (locally) at that point in the history.

No – just trying it on the website to make sure it works. Funny discrepancy. Can’t be compiler related as I’m locally on 2025-12 as is Exercism:

note $*RAKU.compiler.version;
# v2025.12

I see the problem – it’s got a wrapper class in the stub which needs to go.

1 Like