;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; CSCI-4150 Introduction to Artificial Intelligence, Fall 2002 ; Assignment 1 support code, Version 1.1 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Definitions for problems 4 and 5 ; (define colors '(mauve chartreuse azure ochre)) (define numbers '(1 2)) (define nested-list '(((3)))) (define four 4) ; As mentioned in class today, MIT Scheme does not define "rest". ; I've defined it here because I use it in the "add-up-days" procedure ; below. ; (define rest cdr) ; You may find it useful to have this variable ; (define months '(jan feb mar apr may jun jul aug sep oct nov dec)) ; (add-up-days months) ; ; This procedure depends on your "days-in-month" procedure. If you ; have defined that procedure, this will take a list of months ; (abbreviated as 3 letter symbols) and add up the days in each month ; on the list. (If a month is listed twice, it will be counted twice. ; ; We haven't yet covered recursive procedures in Scheme, so that's why ; I didn't assign this as another problem. However, you should be ; able to understand how it works. ; (define (add-up-days months) (if (null? months) 0 (+ (days-in-month (first months)) (add-up-days (rest months)))))