title: How to return the parameter value in Racket?
body: <p>I have to create a Racket scheme that would return the reverse of a list. I cannot use the built in reverse method or anything like it.
  So far I have done everything to reverse, but the problem is that my method is not returning the value, it is keeping it instead.
  This is what I have done:</p>
  
  <pre><code>#lang racket
  
  (define (rev x) 
    (define n '())
    (define i (- (length x) 1))
    (let loop ()
      (when (&gt; i -1)
        (set! n (append n (list (list-ref x i))))
        (set! i (sub1 i))
        (loop)))
    (set! x n)
    "in method display"
    (displayln x))
  
  "display"
  (define letters'("a" "b" "c"))
  (rev letters)
  "in main program display"
  (displayln letters)
  </code></pre>
  
  <p>when I print inside the method, I get (c b a) but when I print from the main program I get (a b c) which means that my method is not returning the value. What should I do?</p>
  
  <p>this method is returning void, how can I make it return a value?</p>