These are my notes from the book How to Design Programs available online here, using Racket and the Beginner Student Language (BSL) which is lot like the Scheme dialect of LISP.
Prologue
Most of the code is commented out so I can run the latest written code only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
(require 2htdp/image) ;(+ 1 1) ;(+ 2 2) ;(* 3 3) ;(- 4 2) ;(/ 6 2) ;(sqr 3) ;(expt 2 3) ;(sin 0) ;(cos pi) ;(+ 2 (+ 3 4)) ;(+ 2 3 4) ;(+ 1 2 3 4 5 6 7 8 9) ;(* 1 2 3 4 5 6 7 8 9) ;"hello world" ;(string-append "hello" "world") ;(string-append "Hello " "world") ;(string-append "Hello" " " "world") ;(+ (string-length "hello world") 20) ;(number->string 42) ;(string->number "hello world") ;(and #true #true) ;(and #true #false) ;(> 10 9) ;(< 1 0) ;(= 42 9) ;(and (or (= (string-length "hello world") ; (string->number "11")) ; (string=? "hello world" "good morning")) ; (>= (+ (string-length "hello world") 60) 80)) ;(* (image-width .) (image-height .)) ;(circle 10 "solid" "red") ;(rectangle 30 20 "outline" "blue") ;(overlay (circle 5 "solid" "red") ; (rectangle 20 20 "solid" "blue")) (place-image (circle 5 "solid" "green") 50 80 (empty-scene 100 100)) |
Reader Comments