[plt-scheme] critique of some code
On Dec 7, 2009, at 8:01 AM, Todd O'Bryan wrote:
> Well, it's good to finally know what the natural way to do this in
> Scheme is. :-)
You saw two isomorphic solutions, expressed at different
levels of abstraction.
Each and every one of these is something you can do in other
languages. It just so happens that in Scheme you get to see/do
this a lot more easily
>
> Point about the -1/#f problem well-taken, though.
>
> Todd
>
> On Mon, Dec 7, 2009 at 7:54 AM, Prabhakar Ragde <plragde at uwaterloo.ca> wrote:
>> 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
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme