fork download
  1. ; multiples of 5
  2.  
  3. (define (mult5? n)
  4. (let outer ((n (abs n)) (power5 (list 5)))
  5. (if (< (* (car power5) 5) n)
  6. (outer n (cons (* (car power5) 5) power5))
  7. (let inner ((n n) (power5 power5))
  8. (if (null? power5)
  9. (zero? n)
  10. (if (< n (car power5))
  11. (inner n (cdr power5))
  12. (inner (- n (car power5)) power5)))))))
  13.  
  14. (display (mult5? 987)) (newline)
  15. (display (mult5? 985)) (newline)
Success #stdin #stdout 0.03s 8204KB
stdin
Standard input is empty
stdout
#f
#t