;Write a procedure that takes a string and returns a list of unique words in the string. (you may assume that all the functions from homework 1 are defined) You dont have to worry about punctuation. ;; This function takes a string and returns a list with ;; duplicate words removed (define (rem-duplicates str) (no-duplicates (split #\space str)) ) ;; Helper function ;; This function takes a list and returns a new list with ;; duplicate elements removed. (define (no-duplicates l) ;; base case: an empty list has no duplicated. ;; just return the empty list. (if (null? l) '() ;; get the head of the list into a local variable. (let ((head (car l)) (tail (cdr l)) ) ;; if the first element is in the rest of the list ;; then don't add it now. (if (member head tail) (no-duplicates tail) ;; otherwise, add the first element because it ;; is the only time this element occures in the ;; list. (cons head (no-duplicates tail)) ) ) ) )