|
|
||
|
|
Start of topic | Skip to actions
Solution: fastest-runner
; fastest-runner: nonnegative-number -> symbol
;
; Purpose: Given a distance to run (in meters),
; return the fastest runner on the team.
;
(define (fastest-runner distance)
(cond [(< distance 300) 'Marianne]
[(and (>= distance 300) (< distance 1000)) 'Becca]
[(and (>= distance 1000) (< distance 10000)) 'Suzy]
[(>= distance 10000) 'Yvonne]))
'fastest-runner_examples
(symbol=? (fastest-runner 10000) 'Yvonne)
(symbol=? (fastest-runner 8000) 'Suzy)
(symbol=? (fastest-runner 2000) 'Suzy)
(symbol=? (fastest-runner 200) 'Marianne)
(symbol=? (fastest-runner 999) 'Becca)
Access Permissions
Topic Actions: Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
Webs: Main | TWiki | Africa | EmbeddedSystems | Gpce | Houston | International | K12 | MetaOCaml | MulticoreOCR | ProgrammingLanguages | RAP | RIDL | Sandbox | SpeechClub | Teaching | Texbot | WG211 Web Actions: |
|
This work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.