ive been given a task in Scheme (Dr Racket) to reverse to order of a given digit. The solution should be recursive, and this is what i got this far.. The truth is, im not quite sure if the given algorithm even works because i get: " application: not a procedure; expected a procedure that can be applied to arguments" error every time i run it.. Any thoughts or help on the issue?
(define reverse-digits
(lambda (n) (if (> n 9)
(+ (* 10 (modulo n 10)) (reverse-digits (quotient n 10)))
(n))))
(reverse-digits 1234)
application: not a procedureis because you put thenin parentheses, which in that context means that you're trying to callnas a function. - Throw Away Account