Advertisement
cbres13

Basic Reversal Code w/ User Input

Feb 13th, 2019
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.29 KB | None | 0 0
  1. (define (reversal str)
  2.   (if (= (string-length str) 0)
  3.       ""
  4.       (string-append
  5.        (reversal (substring str 1 (string-length str)))
  6.        (string-ith str 0)
  7.        )
  8.       )
  9.   )
  10.  
  11. ; Takes the first letter of the user input, puts it to the end, and then flips itself backwards.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement