Skip to content

Instantly share code, notes, and snippets.

@yao2030
Created November 17, 2012 02:56
Show Gist options
  • Save yao2030/4092883 to your computer and use it in GitHub Desktop.
Save yao2030/4092883 to your computer and use it in GitHub Desktop.
A palindrome is a sentence that reads the same backward as forward.
(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)))
@yao2030
Copy link
Author

yao2030 commented Nov 17, 2012

use "leap of faith" as the basic approach to solving this kind of problem that can be reduced to similar, smaller subproblems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment