[plt-scheme] 3rd-8th Grade

From: Richard Cleis (rcleis at mac.com)
Date: Sun Mar 19 00:45:23 EST 2006

>> This is one reason why the robots were programmed by the one 
>> whiz-kid; he had the icons memorized. However, function names need 
>> memorized for text programming.
>
> True, but keep in mind the barrier of entry.  If we share a common 
> language (English), it should be fairly clear what a function named 
> "(rotate-arm-to-angle 85)" does, versus recognizing that an icon that 
> looks like an arc with an intersecting line (with the number 85 
> hanging off the line) means to rotate the robot's arm through a 
> certain angle.  How can you be sure it doesn't change the speed of the 
> robot to 85%, or that it doesn't elevate the robot's platform to 85 
> mm, or that it sets the room's temperature to 85 degrees?

These robots were simpler, but the same issue arose: a box for the 
light sensor (it sees black tape on a white field) contained a 45.  
When asked what that means, the whiz-kid answered soemething like, "I 
don't know, but it doesn't work if we change it very much."  He's ready 
for Registry Mangling!

>> I was within a gnats-eyelash of using emacs to control and sequence 
>> the operation of our custom laboratory equipment.  That way, we could 
>> have 'taken notes', run experiments, and read the documentation in 
>> the same environment.  Weather data, for example, could have been 
>> periodically inserted by elisp into the notes of principal 
>> investigators.  It seems more useful, in this case, to have a 
>> text-environment control the creation of graphical ones (for images, 
>> diagnostics, controls, etc.) than the other way around.
>
> I got very excited when looking at the simulation module discussed 
> recently on this list.  DrScheme looks almost like Matlab/Mathematica 
> in that you can construct documents that contain text, graphics, and 
> animations.  Very cool -- and this amalgam is probably superior to any 
> single implementation.

It's on the radar screen of future effort.  We have another 'run' at 
the end of the month, but I doubt that I'll have time to install and 
learn enough of that module to make worthwhile use of it.  I need no 
sims, but the tools ought to work fine on real data ;)

>
>>> In closing, I ask you to consider these two equivalent programs to 
>>> compute the sum of five random numbers:
>>>
>>> http://ftp.rasip.fer.hr/research/labview/example5.html
>>>
>>> Compare that with a simple Scheme implementation:
>>>
>>> (require (lib "27.s" "srfi"))
>>>
>>> (define (accum count)
>>>   (letrec ((accum-internal
>>>                   (lambda (x y)
>>>                      (if (eq? y 0)
>>>                          x
>>>                         (accum-internal (+ x (random-integer 100)) 
>>> (- y 1))))))
>>>     (accum-internal 0 count)))
>>
>> My colleagues would not be convinced.
>
> By my clumsy Scheme?  Don't blame Scheme (or text-based languages in 
> general) on that!  :-)

I think it's fine.  But the wary ones balk at the first sign of 
multiple-parens.
>
> I would argue that the graphical example I linked to above is an 
> obscure, byzantine mess.  Why must it be so complicated to do such a 
> simple task?
>
> Discussion  of Example 5:
> On the left side of the screen is a box with 5 inputs and some kind of 
> mysterious rectangle with a dotted line in the middle.  Are these 
> where the random numbers come from?  Or is the page some kind of loop 
> construct?  I am guessing that the dice represent the random number 
> generator, but what are the up/down arrows on the first box?  It looks 
> like the second "page" is for summation, but all inputs seem to come 
> from the lower input to the node -- how does this say to me that it is 
> a running total?  What does the DBL mean on the right-hand-side of the 
> screen?  The text comment (the only sensible thing on the page) tells 
> me it's the "Sum of five random numbers".  I'll have to take their 
> word on it.

We have people who are implementing some labview systems; it'll be 
interesting to see how they will interface the networked scheme 
systems.

rac

>
> Because I know C, the C example seems quite clear, and I would argue 
> that anyone with basic programming skills would be able to puzzle out 
> what it does.  The hieroglyphic (in contrast) seems messy and verbose 
> (sort of like writing a GUI in MFC).
>
> Perhaps it would be clearer if I had written it like so:
>
> (require (lib "27.s" "srfi"))
>
> (define (sum-loop running-total count)
>   (if (eq? count 0) running-total
>       (sum-loop (+ running-total (random-integer 100)) (- count 1))))
>
> (define (sum-of-random-numbers count)
>   (sum-loop 0 count))
>
> This might be a bit more readable for a new schemer.
>
> But of course, these are just my opinions.
>
> - -Brent
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (Darwin)
>
> iD8DBQFEHOdUzGDdrzfvUpURApfhAJ4lORQFTBrFD2/Y+OTbqxKQtpkDNQCfc4w4
> 239me34pPl/B5dq7d0YIgkY=
> =yj5a
> -----END PGP SIGNATURE-----



Posted on the users mailing list.