The room draw solution

The room draw solution - The room draw problem Kathi Fisler...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; The room draw problem ; Kathi Fisler ;; First, the data definitions ; a request is (make-request symbol symbol (number number -> symbol)) (define-struct request (student1 student2 choose)) ; an asgmt is (make-asgmt symbol symbol symbol) (define-struct asgmt (student1 student2 dorm)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;; ;; Now, the function. This is like any other list problem until you get to filling ;; in the template. Let's start with the template. (define (request-func areq) (request-choose areq) (request-student1 areq) (request-student2 areq) ... ) (define (draw-rooms mor dan alor) (cond [(empty? alor) ...] [(cons? alor) (request-func (first alor)) ... (draw-rooms (rest alor)) ... ])) ;; Now think about the function. We clearly need to know which dorm the first request ;; is going to, so introduce a cond to check which dorm is requested: (define (draw-rooms mor dan alor) (cond [(empty? alor) ...] [(cons? alor) (cond [(symbol=? 'morgan ????) (request-func (first alor)) ......
View Full Document

This note was uploaded on 02/06/2008 for the course CS 1102 taught by Professor Fisler during the Fall '07 term at WPI.

Page1 / 3

The room draw solution - The room draw problem Kathi Fisler...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online