[plt-scheme] critique of some code

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Mon Dec 7 07:54:10 EST 2009

Matthias wrote:

> You can also assign it to those of your students who understand
> accumulators (which is what many loops require, but we let students
> loose on for/do/while/repeat/rinse/one-more-time with nothing but
> intuition).

I would characterize the solution as structural recursion, since the 
accumulator is counting up towards a known bound. I know these 
categories are fuzzy at the edges, but my point is that I think this is 
a fair exercise in the "structural recursion on two values" part of an 
HtDP-based course. I often assign a similar question (using lists of 
symbols, and producing true/false instead of an index) at this point. --PR


Posted on the users mailing list.