|
|
||
|
|
Start of topic | Skip to actions
Solution: within-two?
; within-two?: number, number -> boolean
; Purpose: Returns whether m,n are less than 2 apart.
; A difference of exactly 2 returns false.
;
(define (within-two? m n)
(cond [(>= (- m n) 2) false]
[(>= (- n m) 2) false]
[else true]))
'within-two?_examples
(boolean=? (within-two? 99.8 101) true)
(boolean=? (within-two? 5 -5) false)
(boolean=? (within-two? 7 7) true)
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.