The classical introductory exercise. Just say "Hello, World!".
"Hello, World!" is the traditional first program for beginning programming in a new language or environment.
The objectives are simple:
If everything goes well, you will be ready to fetch your first real exercise.
For installation and learning resources, refer to the exercism Racket page.
You can run the provided tests through DrRacket, or via the command line.
To run the test through DrRacket, simply open the test file and click the 'Run' button in the upper right.
To run the test from the command line, run the test from the exercise directory with the following command:
raco test hello-world-test.rkt
which will display the following:
raco test: (submod "hello-world-test.rkt" test) 2 success(es) 0 failure(s) 0 error(s) 2 test(s) run 0 2 tests passed
This is an exercise to introduce users to using Exercism http://en.wikipedia.org/wiki/%22Hello,_world!%22_program
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
#lang racket (require "hello-world.rkt") (module+ test (require rackunit rackunit/text-ui) (define suite (test-suite "hello world tests" (test-equal? "no arg returns Hello, World!" (hello) "Hello, World!") (test-equal? "with arg returns Hello, arg!" (hello "exercism") "Hello, exercism!"))) (run-tests suite))
#lang racket (provide hello) (define hello (lambda ([x "World"]) (string-append "Hello, " x "!")))
A huge amount can be learned from reading other people’s code. This is why we wanted to give exercism users the option of making their solutions public.
Here are some questions to help you reflect on this solution and learn the most from it.