Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (translate '("ark" "gold"))
- "arkway golday"
- (define (piglatin phrase)
- (string-split translate phrase))
- string-split: contract violation
- expected: (or/c string? regexp?)
- given: '("ark gold")
- #lang racket
- (define (piglatin phrase)
- (string-split translate phrase))
- (define (translate sentence)
- (string-join (map breakSentence sentence)))
- ; break down sentance string split into a list
- (define (breakSentence word)
- (list->string (listWord (string->list word))))
- ; break down word for vowel testing
- (define (listWord word)
- (cond
- ((foundVowel (car word))
- (startsVowel word))
- (else(noVowel word '()))))
- ; letters that are vowels, their prensence indicates way should be added to end
- (define (foundVowel letter)
- (member letter '(#a #e #i #o #u #y)))
- ; allow adding way to end of word
- (define (startsVowel word)
- (append word '(#w #a #y)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement