Hi. 👋🏽 👋 We are happy you are here. 🎉 🌟
exercism/odin is one of many programming language tracks on Exercism.
This repo holds the instructions, tests, code, and support files for Odin exercises currently under development or implemented and available for students.
🌟 Track exercises support the dev-2025-10 release of Odin.
Exercises are grouped into concept exercises teaching the Odin syllabus, which will eventually live here, and practice exercises, which are unlocked by progressing in the syllabus tree 🌴 .
Concept exercises are constrained to a small set of language or syntax features.
Practice exercises are open-ended, and can be used to practice concepts learned, try out new techniques, and play. These two exercise groupings can be found in the track config.json, and under the odin/exercises directory.
🌟🌟 Please take a moment to read our Code of Conduct 🌟🌟
It might also be helpful to look at Being a Good Community Member & The words that we use.
Some defined roles in our community: Contributors | Mentors | Maintainers | Admins
Are you here to suggest a new feature or new exercise?? Hooray! 🎉
We'd love if you did that via our Exercism Community Forum where there is a dedicated thread for the new Odin track.
Please read Suggesting Exercise Improvements & Chesterton's Fence.
Thoughtful suggestions will likely result in faster & more enthusiastic responses from volunteers.
✨ 🦄 Want to jump directly into Exercism specifications & detail?
Structure | Tasks | Concepts | Concept Exercises | Practice Exercises | Presentation
Writing Style Guide | Markdown Specification (✨ version in contributing on exercism.org)
If you are interested in contributing a new exercie to the Odin track, it is important to follow the steps below:
- Look at the Odin Exercise Wishlist to see which exercises are waiting on implementation.
- Let the Odin Track Team know that you would like to claim an exercise by posting to the Odin Thread on the Exercism Forum.
- If the exercise is still available we will let you know and assign it to you in the Odin Exercise Wishlist.
- Once the exercise is assigned to you, you can start working on it.
- When ready to publish, please note that we will accept only one exercise per Pull Request. It helps us provide better review and avoid for a lot of work to be tied pending approval because of a problem with a single exercise. You can still claim and work multiple exercises concurrently, just one per PR.
- The Odin track is new, the tooling and documentation is still imperfect and we welcome help in improving it. If you get stuck or need help please let us know by posting to the Odin Thread on the Exercism Forum. We will do our best to help you be a successful contributor. If you give it a try and decide, this is not for you, please let us now so that we can put the exercise back into the wishlist.
- You need Odin installed, if you don't have it already, follow the installation instructions
- If you have a previous installation of Odin, the language is still evolving and minor syntax difference may cause your program to compile locally but fail when run via the Exercism toolchain. The installation instructions contains the version that the Odin track is currently using. We would encourage you to update to that version or at least be aware of the differences.
- If your IDE or text editor supports it, you will benefit from the Odin Language Server and Formatter. They can be found here. The README contains information on setup for different text editors.
- You need to fork the Odin Exercism repository and clone a copy on your local machine (we will call this local copy
$EXERCISM_ODINin the text below). - On Windows, since all the scripts are setup for bash (
.sh), I would recommend installing Git for Windows and running the following command from the git bash. This will automatically call your Windows installation of Odin, as long as it is in your path. - In your local
$EXERCISM_ODINrepo, runbin/fetch-configlet.sh. Theconfigletscript is Exercism tools to create and check exercises. - In your local
$EXERCISM_ODINrepo, runbin/fetch-ols-odinfmt.sh. This will install the Odin formatter for the Odin track tool so this is a different installation than the one you are using for your text editor.
Here is a brief description of the tools you will find in $EXERCISM_ODIN/bin:
bin/configletis the exercism tool. Options that you may use:lint: perform a general check on the track exercise andconfig.jsonfile. If an exercise documentation or test description has been updated in the Problem Specification repository, the tool will let you know.sync: ifconfiglet lintreport inconsistencies with the Problem Specification repository, usebin/configlet sync -uto fix them.
bin/format-all.shwill runodinfmton all.odinfiles in the repository, using the Odin track approving formatting rules.bin/run-test.shruns the tests for a specific exercise, or for all exercises if no exercise name is provided.bin/verify-exerciseschecks the integrity of all exercises, including tests. It is used by the build system whenever new code is pushed to the repository.bin/gen-exercise.shis used to generate a new exercise. (Don't callbin/configlet createdirectly,gen-exercise.shwill take care of it but also includes additional steps).
To create a new exercise, follow the steps below:
- Find the
<slug name>associated with your exercise. The<slug-name>is the exercise name with all lowercase and spaces replaced with dashes (Ex: Circular Buffer slug name is circular-buffer) - run
bin/gen-exercise.sh <slug-name>- This will ask for your github id and an exercise difficulty
- For exercise difficulty, use 2 for easy, 5 for medium, and 9 for hard. Don't sweat it too much, maintainers will help you during the PR review.
- This will add an entry in
$EXERCISM_ODIN/config.jsonfile for your exercise and add a directory under$EXERCISM_ODIN/exercises/practice/<slug name>with the exercise files.
- Under
$EXERCISM_ODIN/exercises/practice/<slug name>, edit the following files:<slug name>.odinwill contain the skeleton solution file provided to the student. It should only include data structures and exercise procedures to implement with a dummy body.<slug name>_test.odinwill contain your test suite..meta/example.odinwill contain your example solution (should pass all the tests).gen-exercise.shattempted to populate the skeleton solution and test file from the problem specification but this tool is lacking right now. If the content of these files, doesn't look right, you can just remove it for now and use your exercise problem specification instead (see below).
- I would recommend looking at your exercise specification under the Problem Specification repository, under the subdirectory
exercises/<slug name>, specifically thecanonical-data.jsonfile. It specifies the test suite your exercise should implement. - I would also recommend using this implemented Odin Exercise as an example of what each file should contain.
- The purpose of the example solution is to prove that the problem can be solved. It doesn't necessarily have to be the most efficient or idiomatic code. Reviewer may still recommend changes but there are multiple path to solving an exercise.
- When coding, be consistent with the Odin Style Guide. Future version of the track tooling may enforce its convention.
- Do not comment out any of the tests. Some Exercism tracks use the convention that only the first test should be un-commented, following a TDD approach. Due to limitations with the tools, the Odin track follows the convention that all tests should be un-commented. You can read the Odin Test documentation for details.
- Once you have populated the tests and the example solution, run
bin/run-test.sh exercises/practice/<slug name>to test your implementation. It should show you that first, your example pass all the tests and second, the student solution stub fails all the tests.- The Odin test running uses a tracking allocator that report memory leaks and dual de-allocations. To be successful, your implementation should ensure there is no memory allocation warnings in addition to failing tests.
- If you work with an editor such as VSCode, I would recommend one of two approaches to ensure your IDE is happy:
- Approach 1: move your
<slug name>_test.odinin the.meta/directory. This allows the IDE to see both the solution and the test at once. It provides code hints, code references and allow debugging of tests. - When you are done, make sure to move your test file one directory up and to populate
<slug name>.odinwith the data structures and stubs of the procedures to implement. - Approach 2: use the
<slug name>.odinto implement your solution. The solution and test are in the same directory which will make your IDE happy. Once you are done, you can copy the solution to.meta/example.odinand replace the body of the procedures in your student stub (<slug name>.odin) with#panic(Implement this procedure.).
- Approach 1: move your
- Once you are happy with your test, you can run:
bin/format-all.shto make sure your test is formatted properly (note: this will also format the other tests which should already be correct. If some changes occur, you can report this to the track maintainers or open an issue on the Odin repository).bin/verify-exercisesto run all the tests. This is equivalent tobin/run-test.sh.bin/configlet lintto check that all the supporting and configuration files are correct.
- You should now be ready to submit your Pull Request