Article View: comp.lang.logo
Article #254Re: um, maybe this is a silly question
From: Max Hailperin
Date: Tue, 13 Oct 1992 10:30
Date: Tue, 13 Oct 1992 10:30
45 lines
3263 bytes
3263 bytes
In article <1bcfa5INN4bs@agate.berkeley.edu> bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes: I do agree with the part of the message that says that programmers have to be trained to learn to think recursively. That's why colleges should use Abelson and Sussman as their intro programming course, and high schools should use Logo! :-) I find it mildly odd that you suggest a textbook for colleges, a language for high schools. Of course, since I know you favor the "enlightened playing around" approach to "providing a context for learning" (as opposed to "teaching"), the environment/language is playing somewhat of the same role as a textbook. Still, let me suggest an alternative language that merits serious consideration for the high school level, and complete the parallelism by suggesting a high school level textbook for it. The language: also scheme, the same as for the college level. The text: The Schemer's Guid, by Iain Ferguson, with Edward Martin and Burt Kaufman. Back to the original thread, I pointed out offline that the key distinction in learning isn' between recursive and iterative but between faith and tracing out in your head. The big problem with the way most people learn iteration is that they think about it in the trace-it-out style, by looping around and around until done. But, then again, the same mind-bug affects recursion as well -- these self-same learners typically wind up trying to chase down all the branches of a recursion tree to the leaves in their heads too. The right approach in either case is to take on faith that a procedure (even the one you are writing) does what it claims to. So, the way you think about recursive factorial is by assuming that the factorial procedure applied to n-1 really does compute (n-1)! and therefore concluding that n times that will be n!. Equally well for iteration, you assume on faith that the procedure fact.help meets its spec that (fact.helper :n :x) computes n! * x. Therefore, in the body of fact.helper, when it does fact.helper (:n - 1) (:n * :x) you can just take on inductive faith that this is computing the factorial of its first argument times the second argument, i.e. (n-1)!*(n*x), which by a little juggling equals n!*x as desired. The real problem is trying to trace it all through instead of having faith (of the inductive variety). [Pardon any logo syntax errors, it's been a long time since I did logo.]
Technical Details
Message-ID:
<MAX.92Oct13103000@Kolmogorov.gac.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!spool.mu.edu!umn.edu!msus1.msus.edu!gacvx2.gac.edu!nntp-server!maxReferences:
<1992Oct11.192128.5448@netcom.com> <1ba7vcINNpam@agate.berkeley.edu><1992Oct12.163421.24051@sctc.com> <1bcfa5INN4bs@agate.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!spool.mu.edu!umn.edu!msus1.msus.edu!gacvx2.gac.edu!nntp-server!max Newsgroups: comp.lang.logo Subject: Re: um, maybe this is a silly question Message-ID: <MAX.92Oct13103000@Kolmogorov.gac.edu> From: max@Kolmogorov.gac.edu (Max Hailperin) Date: 13 Oct 92 10:30:00 Reply-To: Max Hailperin <max@nic.gac.edu> References: <1992Oct11.192128.5448@netcom.com> <1ba7vcINNpam@agate.berkeley.edu><1992Oct12.163421.24051@sctc.com> <1bcfa5INN4bs@agate.berkeley.edu> Distribution: usa Organization: Gustavus Adolphus College, St. Peter, MN Nntp-Posting-Host: kolmogorov.gac.edu In-reply-to: bh@anarres.CS.Berkeley.EDU's message of 12 Oct 1992 18:14:29 GMTLines: 45 Lines: 45