[racket] Bothersome solution to HtDP/2e Rocket Landing Discussion

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Feb 23 16:43:58 EST 2014

On Feb 23, 2014, at 4:14 PM, Lawrence J Winkler wrote:

> I recently starting reading HtDP/2e to evaluate the approach to teaching programming. My motivation, in part, stems from the recent Computer Science Education Week last December, where many were given the opportunity to experience one hour of programming. 
> 
> I'm interested in reviewing different teaching approaches and processes


To evaluate HtDP/2e you should not read the Prologue at all. Or skip to the sections called "You are a Programmer Now" and "Not!". The point of the Prologue is to give readers an idea of 'garage programming' (term coined by famous software engineering researcher, Fred Brooke) and to then say 'but how do people go about designing programs as opposed to puzzling them out.' 





> (define (place-image-bottom img x y canvas)  
>  (place-image img x (img-center-pos img y) canvas))
> 
> (define (img-center-pos img vert-pos) (- vert-pos (/ (image-height img) 2)))
> 
> (define (create-rocket-scene.v3 ht)
>  (if (<= ht 100) (place-image-bottom rocket 50 ht (empty-scene 100 100))
>      (place-image-bottom rocket 50 100 (empty-scene 100 100))))
> 
> In any case, it would seem easier for me to motivate this abstraction to new students. 


Here is the experiment that Mark proposed: 

(require 2htdp/image)

(define ball (circle 30 'solid 'red))
(define table (rectangle 200 10 'solid 'blue))

(define ball-on-table (overlay ball table))

ball-on-table 

(define ball-pb (put-pinhole (/ (image-width ball) 2) (image-height ball) ball))
(define ball-pb-on-table (overlay/pinhole ball-pb table))

ball-pb-on-table

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140223/543c601e/attachment-0001.html>

Posted on the users mailing list.