[Haskell-beginners] Is there a way to use images as parameters to
Haskell functions?
Benjamin L.Russell
DekuDekuplex at Yahoo.com
Mon Aug 18 05:36:51 EDT 2008
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:
>
>> <rocket-s.jpg>
At the above prompt, the actual image of <rocket-s.jpg> is inserted,
not the textual reference to the image. I.e., there is a picture at
the prompt, instead of text.
Further, these images can be used as parameters, similarly to strings,
in functions; viz.:
>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
More information about the Beginners
mailing list