; two palindrome exercises

(define (number-palindrome? n)
  (let loop ((x n) (z 0))
    (if (zero? x) (= n z)
      (let ((q (quotient x 10)) (r (remainder x 10)))
        (loop q (+ (* z 10) r))))))

(display (number-palindrome? 123454321)) (newline)
(display (number-palindrome? 123456789)) (newline)

(define (mappend f . xss) (apply append (apply map f xss)))

(define (string-palindrome? xs)
  (let ((chars (mappend string->list xs)))
    (equal? chars (reverse chars))))

(define x '("a" "bcd" "ef" "g" "f" "ed" "c" "ba"))
(display (string-palindrome? x)) (newline)
(display (string-palindrome? (cdr x))) (newline)