[plt-scheme] 2htdp/image questions

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Sun Apr 18 15:00:43 EDT 2010

On Apr 18, 2010, at 10:20 AM, Marco Morazan wrote:

>> ; map-image : (x y color -> color) image -> image
>> which allows you to easily write, for example, a color gradient  
>> transform.
> I am curious why you would want to write the specification that way. I
> would have stated it as:
> ; map-image: (pixel -> color) image -> image
> This, of course, assumes that structures have been introduced and that
> there is a structure called pixel.

Depends what's IN the structure called pixel.  Does it know where it  
is in the image?  If so, then it's equivalent (but slightly less  
convenient to use).  If not, then there are lots of easy-to- 
understand transforms that I can't do with it, e.g. add a diagonal  
blue gradient to an existing picture.

>> ; build-image : width height (x y -> color) -> image
>> But if I want my students to be able to use this before they've  
>> seen local
>> or lambda, I would want them to be able to specify "side  
>> parameters" (which
>> are curried in before calling the above version):
> Do your students see HOFs before lambda and local?

In a sense, yes, because they write animations starting in about Week  
3.  From their perspective, "on-tick", "on-draw", and so on are  
higher-order functions: they look like functions, and they take in  
functions as arguments.

Stephen Bloch
sbloch at adelphi.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100418/ae25cfb5/attachment.html>

Posted on the users mailing list.