Repository navigation
Add the relative-distance exercise - #910
Conversation
Ported from the Java track. "No known relationship" is `None`: the canonical data's `null` becomes an `Option[Int]`. The suite is generated from the canonical data. Unlike the other generated suites it is written in the Scala 3 braceless style that .scalafmt.conf asks for, laid out the way scalafmt would lay it out, so its template does not use the shared header/test_open macros, which still emit braces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hello 👋 Thanks for your PR. This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed. If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track. Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum. (cc @exercism/cross-track-maintainers) |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This PR has been translated 🚀 |
IsaacG
left a comment
There was a problem hiding this comment.
Looks good to me.
Note, as a general rule, translation should only happen after approval, right before merging. That avoids multiple translations if a change is requested, reducing the cost.
Adds Relative Distance, which the Java track already has.
The API follows the Java track: the family tree goes to the constructor and the query is a method.
"No known relationship" is
None: the canonical data expectsnull, and the track already usesOptionfor "no answer" (e.g. binary-search). Java returns-1instead.Scala 3 syntax
The stub, the example and the test suite are written in the braceless style that
.scalafmt.confasks for (removeOptionalBraces,convertToNewSyntax). All three passscalafmt --testwith the track's config.The suite is generated from the canonical data by
bin/generate-tests. Its template doesn't use the sharedheader/test_openmacros, because those still emit braces. It lays the suite out the way scalafmt would: wrapping atmaxColumn(160), with trailing commas and the->arrows aligned asalign.preset = mostdoes. When the shared macros move to the braceless style, this template can switch back to them.Checked locally
bin/test relative-distance: 7/7 against the exampleNotImplementedError, the other six are pendingbin/generate-tests --check,configlet lintandconfiglet sync -e relative-distanceare clean🤖 Generated with Claude Code