[plt-scheme] 2htdp/image questions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 21 22:55:23 EDT 2010

On Apr 20, 2010, at 10:33 PM, Stephen Bloch wrote:

>> all in one week is ludicrous
> 
> Yes, it is... but they can be given sample code that uses all those things, and copy it, and tweak various parts of the code until it (a) compiles without error, and (b) does something interesting.  


That's precisely what happened here. Two thirds of the students ended up with co-ops that had _no_ programming content. Our students could not program. They could guess and tweak. 

We must call out the fallacy of the approach. Nothing else will help us. 

>> If you do wish to experiment with such loops, I recommend a Universe-like interface so that the function is more a description of an interaction -- like big-bang and universe -- rather than a map/for-each like construction.
> 
> I don't have a clear idea what that would look like.  A little more detail?


Instead of a higher-order function, provide a mini-language along the lines of big-bang. Roughly speaking, big-bang is a little language for describing the connection between some peripherals and the computer os. In your case, you could say 

 (process image0 
    (on-red ...)
    (on-green ...)
    (on-blue ...))

and the three functions would process the shares of red, blue and green for one and the same pixel. You could add an on-alpha. For the time after structures, you could have on-rgb (just make sure that you have either on-rgb or the three above). 

The semantics is kind of like the one in big-bang. You apply these functions to pixels in some order and collect the result for them. 

To the students, it's a little language not a truly higher-order function. 

>> Otherwise the Pythonistas will simply say "but why would somebody want to do that, when they could be doing something useful and cool like this?"


Why can't they do what DrScheme can't do? Why can't their IDE deal with inserted pictures and make them into truly first-class (abstract) values? Why can't they compare the before and after picture and produce a diff picture? 

Why don't you *challenge them* when they sell snake oil to the audiences? 

;; --- 

I am afraid that your students will pretty soon discover that your functional approach is inferior in performance. We're not talking about handling 20 or 30 events per second, we talking about 400 x 400 pixels. 

Try performance testing first!! 

;; --- 

Try it out but be prepared to discover the limits of a purely functional world. Also read up on Processing while you're at it. 



Posted on the users mailing list.