title: Reversing an integer
body: <p>I am trying to write a function which takes an input number and outputs the number in reverse order.</p>
  
  <p>Ie:</p>
  
  <p>Input -> 25
  Output -> 52</p>
  
  <p>Input -> 125
  Output -> 521</p>
  
  <p>I am new to lisp, if its helpful here is the working function in c++</p>
  
  <p><strong>function.cpp</strong></p>
  
  <pre><code>int revs(int rev, int n)
  {
    if (n &lt;= 0)
      return rev;
  
    return revs((rev * 10) + (n % 10), n/10);
  }
  </code></pre>
  
  <p>I have written it in Racket as follows:</p>
  
  <pre><code>(define (revs rev n)
    (if (&lt;= n 0)
       rev
       (revs (+ (* rev 10) (modulo n 10)) (/ n 10))))
  </code></pre>
  
  <p>But when I run it with (revs 0 125) I get this error:</p>
  
  <pre><code>modulo: contract violation
    expected: integer?
    given: 25/2
    argument position: 1st
    other arguments...:
     10
  </code></pre>
  
  <p>Certainly I am doing something incorrect here, but I am unsure of what I am missing.</p>