I know the basic algorithm for this problem but I am having trouble changing the sentence into a list inside my conditional. I created make-list to make it easier on myself but I’m not sure where to put it in the code. For ex, in the first cond statement, I need the sentence to be a list before I check if the first element in the sentence is a vowel.. but I have been doing it syntactically wrong.
vowel-ci? returns #t if a character is a case insensitive vowel, and #f otherwise.
stenotype takes a sentence and returns it with all vowels removed.
(define make-list
(lambda (string)
(string->list string)))
(define stenotype
(lambda (sentence)
(cond
[(vowel-ci? (car sentence)) (stenotype (cdr sentence))]
[else (cons (car sentence) (stenotype (cdr sentence)))])))
There are a few different tasks (preparing input so it can be processed by your implementation and the processing itself), which you’ve broken into two different functions. The next step is combining the functions, rather than rewriting the latter to use the former. The simplest way of combining functions is composition. Compose
make-listandstenotype(you may wish to name this composition) and you’ll have your solution.Note that you’re missing a base case in
stenotypeto end the recursion.