Created
November 17, 2012 02:56
-
-
Save yao2030/4092883 to your computer and use it in GitHub Desktop.
A palindrome is a sentence that reads the same backward as forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (pal-helper wd) | |
(cond ((<= (count wd) 1) #t) | |
((equal? (first wd) (last wd)) | |
(and #t (pal-helper (bl (bf wd))))) | |
(else #f))) | |
(define (palindrome? sent) | |
(pal-helper (accumulate word sent))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use "leap of faith" as the basic approach to solving this kind of problem that can be reduced to similar, smaller subproblems