Exercism problems in Racket.
We welcome both improvements to the existing exercises and the addition of new exercises. A pool of exercise ideas can be found in the x-common repo. An overview about which language tracks implement which exercises is at synopsis.exercism.io.
Each exercise should have an example solution and a test suite, as well as a stub file for the solution declaring the module and exports.
The example solution should be named example.rkt
. The test should be named <exercise-name>-test.rkt
, and the stub should be named <exercise-name>.rkt
.
For example, if you were to work on the binary
exercise, you would have the following three files:
$ tree
.
├── binary.rkt
├── binary-test.rkt
└── example.rkt
The Racket code in this repo is meant to conform with the conventions set forth in How to Program Racket.
Try to avoid external dependencies.
Prior to submitting a pull request, ensure that your test requires the stub file, and not the example file - like so:
#lang racket/base
(require "perfect-numbers.rkt")
(module+ test
(require rackunit rackunit/text-ui)
(define suite
(test-suite
"perfect numbers tests"
(test-equal? "no perfect numbers in 1 - 5"
(perfect-numbers 5)
'())))
(run-tests suite))
The exercise should also be added as a value for the problems
key in config.json; otherwise, the pull request will not pass the Travis CI build. Use Order of exercises in our wiki to find a good place for the new exercise in the curriculum.
You can perform additional checks by running the following in your terminal:
bin/check_exercises.sh
and:
bin/configlet lint .
Your pull request won't pass the Travis CI build if either of those fail.
If you're new to Git, take a look at this short guide.
Please do not add a README or README.md file to the problem directory. The READMEs are constructed using shared metadata, which lives in the exercism/x-common repository.
Please see the contributing guide
The Racket logo was created by Matthew Butterick and released under the Creative Commons Attribution-Share Alike 3.0 Unported license. We have adapted it, changing the colour scheme, for use on Exercism.