[plt-scheme] arrow.ss teachpack

From: Connor Ferguson (psfreak at linkline.com)
Date: Sat Feb 28 19:38:44 EST 2004

Thanks, I'll try that. Sorry if I've wasted a lot of your time being a real
idiot.

-Connor
on 2/28/04 4:09 PM, Bruce Hauman at bhauman at cs.wcu.edu wrote:

> Connor Ferguson wrote:
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>> 
>> I get the loop thing, Bruce,  but I am still having trouble with the
>> control-up-down.
>> 
>> When you said that move-picture needed to return the translated shape, I
>> figured that instead of changing move-picture, I could just use
>> translate-losh. Anyway, I changed the definitions for ud-lander and
>> lr-lander and added the extra item to process like you said.
>> 
>> ;; ud-lander : list-of-shapes number  -> boolean
>> (define (ud-lander LUNAR delta)
>> (translate-losh LUNAR 'ver delta))
> The items to process here are in the wrong order.
> 
> It should be
> 
> ;; ud-lander : number list-of-shapes -> list-of-shapes
> (define (ud-lander delta losh)
> (translate-losh losh 'ver delta))
> 
> This is stated clearly on the arrows.ss teachpack page in HelpDesk.
> 
> Have you been using this page as a reference to help you?
> 
> It states:
> "The move function consumes a number and a shape and re-draws the shape
> on some canvas and produces a shape that is translated by N pixels
> left or right."
> 
> So, the corrected ud-lander function above consumes the right values and
> returns the right type of value _but_ it does not draw the losh as
> control-up-down requires. It only returns the translated losh.  So, this
> still will not work properly.
> 
> If you look at the arrows.ss teachpack page in HelpDesk you will
> see the example move function below:
> 
> 
> ;; move : number shape -> shape or false
> ;; to move a shape by delta according to translate
> ;; effect: to redraw it
> (define (move delta sh)
> (cond
> [(and (clear-solid-disk sh RAD)
> (draw-solid-disk (translate sh delta) RAD))
> (translate sh delta)]
> [else false]))
> 
> Study this function it contains the design recipe you need in order to
> write your own move functions lr-lander and ud-lander.
> 
> Also, read the arrows.ss teachpack page very carefully because
> control-up-down will not work unless you give it the right items to process.
> 
> I hope this helps.
> 
> Bruce
> 
> 
> 
> 
> 

-Connor 



Posted on the users mailing list.