;;;; ; tests.scm - Spring '04 ;;;; ;;; problem 1 ;;; (define example-table your-code-here) (table-insert! your-code-here example-table) ; ... ; tests (table-display example-table) (pp example-table) ;;; problem 2 ;;; (define books (make-empty-table (list (make-column 'title 'symbol) (make-column 'author 'symbol) (make-column 'rating 'number)))) (table-insert-all! '((sicp abelson-sussman 8) (return-of-the-king jrr-tolkien 9) (treatment-of-subordinates darth-vader 4) (project-grading ben 2) (all-things-stata frank-gehry 5) (biting-the-hand-that-feeds-me my-cat 1)) books) (table-display books) ;;; problem 3 ;;; (table-display (table-select (lambda (row) (> (get 'rating row) 4)) books)) ;;; problem 4 ;;; (table-display (table-order-by 'rating books)) ;;; problem 5 ;;; (table-delete! (lambda (row) (eq? (get 'author row) 'my-cat)) books) (table-display books) ;;; problem 6 ;;; (table-update! (lambda (row) (eq? (get 'title row) 'project-grading)) 'rating (lambda (row) (+ 2 (get 'rating row))) books) (table-display books)