Skip to content

Commit b227c47

Browse files
authored
Merge pull request kennyledet#526 from mukeshtiwari/master
Palindrome solution in Racket
2 parents 67d2d02 + 5820378 commit b227c47

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#lang racket
2+
(require "palindrome.rkt"
3+
rackunit)
4+
5+
;unit test
6+
(check-eq? #t (palindrome-string "palinilap"))
7+
(check-eq? #f (palindrome-string "helloworld"))
8+
(check-eq? #t (palindrome-string "alula"))
9+
(check-eq? #t (palindrome-string "palindromemordnilap"))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#lang racket
2+
(provide palindrome-string)
3+
4+
(define (string-reverse s)
5+
(list->string (reverse (string->list s))))
6+
7+
(define (palindrome-string str)
8+
(string=? str (string-reverse str)))
9+

0 commit comments

Comments
 (0)