
Recently, I came across a new book for beginner-level programmers that uses the idea of images as parameters to functions, and was wondering whether there is any way to do this in Haskell (they use PLT Scheme in DrScheme): How to Design Programs/2e: Prolog - Section 2 - Arithmetic and Arithmetic: http://www.ccs.neu.edu/home/matthias/HtDP/Prologue/book-Z-H-4.html
Before we show you how to do some ``real'' programming, let's discuss one more kind of data to spice things up:
At the above prompt, the actual image of
One important library -- world.ss -- supports operations for computing the width and height of an image:
(* (image-width ) (image-height ))
Once you have added a library to your program, clicking Run gives you
1200
because that's the area of a 30 x 40 image.
The idea of using images as parameters to functions in teaching programming to beginners could be useful in motivating learning Haskell as well, and should be implementable as such. Does anybody know of any similar tool for Haskell? -- Benjamin L. Russell