[Edu-sig] Re: Teaching Middle-School Math with Python
Tue, 10 Oct 2000 15:50:01 -0700
> Also, I'd think you'd _want_ to cover car and cdr when approaching
> programming in Scheme
>Why? That would be silly. Teaching in middle school and even high school
>our objectives are to produce thinking kids who can use some programming
>tool not finished Python/Scheme programmers.
I'll have to look at those docs again. Seems to me that using recursion
as your primary means of looping means you're very often writing stuff
(define (Reduce procedure mylist)
[(= (length mylist) 1)(car mylist)]
[(procedure (car mylist)(Reduce procedure (cdr mylist)))]
> (Reduce + '(1 2 3 4))
> (Reduce * '(1 2 3 4))
def Reduce(proc, mylist):
if len(mylist)==1: return mylist
else: return apply(proc, (mylist, Reduce(proc, mylist[1:])))
>>> import operator
(Note: for illustration purposes only -- Python has a built-in
reduce function that already does the above).
... just back from the docs. Looks like you're using 'first' and 'rest'
in place of 'car' and 'cdr'. That's good. 'car' and 'crd' are silly
names. But I'm not finding where 'first' and 'rest' get defined.
They're not MzScheme primitives i.e. I get an error message when I
try using either one.
Anyway, not to worry, I'll find this missing puzzle piece eventually.
>Absolutely. Model and view is for us who know that Model is about
>functions, relations, compositions, domain, range, sets, ... (see TLL).
>View is about the stupid i/o crap that most languages impose on kids.
Yeah, we don't want to start off on the wrong foot with a lot of
stupid i/o crap, I agree.
Thanks for the dialog. Sounds like we're not in any serious disagreement
at this point.