solution.rkt 324 B

123456789101112131415
  1. #lang racket
  2. ;; https://www.codewars.com/kata/55e6f5e58f7817808e00002e
  3. (provide seven)
  4. (define (seven m)
  5. (define (impl cur steps)
  6. (define x (quotient cur 10))
  7. (define y (modulo cur 10))
  8. (define next (- x (* 2 y)))
  9. (if (< cur 100)
  10. (cons cur steps)
  11. (impl next (+ 1 steps))))
  12. (impl m 0))