;; 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 lect02a) (read-case-sensitive #t) (teachpacks ((lib "world.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "world.ss" "teachpack" "htdp"))))) ; Some sample expressions, reviewing booleans, and if: ; The signature of '>': ; > : number number -> boolean ; (> pi (sqrt 10)) ; literal boolean: false ; Actually, `>` can take in any number of args: (> 10 8 6) (> 10 8 9) ; This is analagous to +, which also can take ; in a variable number of args: (+ 3 4 5 6) ; 'and' is a function which takes in booleans, return boolean: ; (and (> 3 0) (< pi (string-length "hello there")) true) (or false false true false) (not (> 3 4)) (if (> 3 4) "hello" "good-bye") ; Because 'if' returns a value like everything else, ; it can be incorporated in the middle of other expressions: ; (* 17 (if (> 7 3) 4 5)) (+ 2 (if (> 7 3) 4 5) 4) ; Converting types: (number->string 432)