;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-advanced-reader.ss" "lang")((modname lect02a) (read-case-sensitive #t) (teachpacks ((lib "world.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #t #t none #f ((lib "world.ss" "teachpack" "htdp"))))) (define circ1 (circle 25 'solid 'orange)) ;(overlay circ1 (rectangle 15 20 'outline 'black)) #;(define (intensify adj) (string-append "very, " "very " adj)) ; intensify: #;(define (intensify adj) (if (number? adj) (string-append "very, " "very " (number->string adj)) (if (boolean? adj) "way way true" (string-append "very, " "very " adj)))) (define (intensify adj) (cond [(number? adj) (string-append "very, " "very " (number->string adj))] [(boolean? adj) "way way true"] [true (string-append "very, " "very " adj)])) (check-expect (intensify "red") "very, very red") (check-expect (intensify "") "very, very ") #;(define (pluralize num noun) (if (= num 1) (string-append (number->string num) " " noun) (string-append (number->string num) " " noun "s"))) (define (pluralize num noun) (string-append (number->string num) " " noun (if (= num 1) "" "s"))) (check-expect (pluralize 17 "house") "17 houses") (check-expect (pluralize 1 "house") "1 house") (check-expect (pluralize 0 "house") "0 houses") (define (triple n) (* 3 n)) (define triple (lambda (n) (* 3 n)))