Advertisement
pleabargain

How to Design Programs, Second Edition Exercise 5

May 31st, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. ;really not impressed with the racket language at all... after python, it's just ugly with all of its parens.
  2. ;and no tab completion! ugh!
  3. ;I DO like the image support and that is the only reason I keep pressing on.
  4. ;The manual was written by someone who was angry most of the time
  5. ;http://www.ccs.neu.edu/home/matthias/HtDP2e/part_one.html#%28counter._%28exercise._arith-n%29%29
  6. ;
  7. ;
  8. (define cat (image of cat here))
  9. ;Create an expression that computes the area of the image.
  10. ;See exercise 1 for how to create expressions in DrRacket.
  11.  
  12. ;(string-append "the width of the cat is" (image-width cat))
  13. (string-append "the width of the cat is " (number->string(image-width cat)))
  14.  
  15. (string-append "the height of the cat is " (number->string(image-height cat)))
  16.  
  17. (string-append "the area of the cat is " (number->string(* (image-height cat) (image-width cat)))) ;god this is ugly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement