lab4 - #| = LAB 4 = | | Author(s): | Lab Section: | |# ;...

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

View Full Document Right Arrow Icon
| | Author(s): | Lab Section: | |# ;;;; Utility Functions ; ;; Reloads the current file. (define (reload) (load "lab4.scm") ; Change file name if copied to a new file. ) ;; REMINDER: ;; You must include test cases for all procedures you write. ;; Thoroughly test each procedure and be prepared to demonstrate that the code works as expected. w ;;;; ;;;; Step 1 - A Review ;;;; ; ;; Procedure (define (larger a b) (cond ((and (< a 0) (< b 0)) (* a b));checks if both are negative, if so * ((and (= a 0) (< b 0)) (* a b));checks if a is 0 and b<0 returns a*b ((and (= b 0) (< a 0)) (* a b));checks if b=0 and a<0 returns a*b ((or (= a 0) (= b 0)) (+ a b));checks if one is zero returns a+b ((and (> a 1) (> b 1)) (* a b));checks if both a and b >1 returns a*b (else (+ a b));else returns a+b ) ) ;; Test Code (display "=== STEP 1 TEST CASES ===") (newline) (newline) (display (larger -1 -1)) (newline) (display (larger 1 1)) (newline) (display (larger -2 -2)) (newline) (display (larger 0 -1)) (newline) (display (larger 1 0)) (newline) (display (larger 2 2)) (newline) (display (larger -2 2)) (newline) (
Background image of page 1

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

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

This note was uploaded on 01/11/2011 for the course CSCI 1901 taught by Professor Staff during the Fall '08 term at Minnesota.

Page1 / 5

lab4 - #| = LAB 4 = | | Author(s): | Lab Section: | |# ;...

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