;; 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-beginner-reader.ss" "lang")((modname lect01c-examples) (read-case-sensitive #t) (teachpacks ((lib "universe.ss" "teachpack" "2htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "universe.ss" "teachpack" "2htdp"))))) (define foo (+ 15 2)) (define bar (* foo 9)) (+ foo 20 bar) (define (root1 a b c) (/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a))) ; What we want: (= (root1 2 8 -42) 3) ; blend : string, string -> string ; (define (blend wrd1 wrd2) (string-append (substring wrd1 0 (quotient (string-length wrd1) 2)) (substring wrd2 (quotient (string-length wrd2) 2)))) (string=? (blend "happy" "birthday") "hahday") (string=? (blend "" "birthday") "hday") (string=? (blend "" "") "") (check-expect (blend "Stephanie" "Reese") "Stepese")