|
|
||
|
|
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)
(and (< (- m n) 2)
(< (- n m) 2)))
'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: r3 < 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:
Teaching.210lab01-within-two1 moved from Teaching.210lab02-within-two1 on 12 Sep 2007 - 20:29 by ChrisWarrington - put it back
|
|
This work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.