;; long-words: ListOfString -> ListOfString ;; produces a list of words with more than 5 characters (define (long-words alos0) (local [(define (long-words alos acc) (cond [(empty? alos) acc] [(cons? alos) (if (> (string-length (first alos)) 5) (long-words (rest alos) (cons (first alos) acc)) (long-words (rest alos) acc))]))] (long-words alos0 empty))) (define-struct account (acctnum balance)) ;; an Account is a (make-account Natural Number) ;; where acctnum is the account number ;; balance is the balance in the account (in dollars) ;; a ListOfAccount is one of ;; empty ;; (cons Account ListOfAccount) ;; Citibank: ListOfAccount ;; remembers the information about each account in the list (define Citibank (list (make-account 1 500) (make-account 2 1000) (make-account 3 10))) ;; add-account: Natural Number -> void ;; makes a new account and adds it to Citibank ;; EFFECT: changes the contents of Citibank (define (add-account acctnum amt) (set! Citibank (cons (make-account acctnum amt) Citibank)))