Article View: alt.folklore.computers
Article #623707Re: The birth of BASIC
From: Joe Pfeiffer
Date: Mon, 04 Jun 2018 21:40
Date: Mon, 04 Jun 2018 21:40
85 lines
6246 bytes
6246 bytes
Charles Richmond <nume...@aquaporin4.com> writes: > On 6/4/2018 2:05 PM, Joe Pfeiffer wrote: >> Charlie Gibbs <cgibbs@kltpzyxm.invalid> writes: >> >>> On 2018-06-04, Gareth's Downstairs Computer >>> <headstone255.but.n...@yahoo.com> wrote: >>> >>>> On 04/06/2018 12:13, Bob Eager wrote: >>>> >>>>> On Mon, 04 Jun 2018 06:28:37 -0400, Peter Flass wrote: >>>>> >>>>>> Gareth's Downstairs Computer >>>>>> <headstone255.but.n...@yahoo.com> wrote: >>>>>> >>>>>>> On 03/06/2018 22:40, Peter Flass wrote: >>>>>>>> >>>>>>>> Some problems are easily solved by recursion that are significantly >>>>>>>> more complicated otherwise. >>>>>>> >>>>>>> I would be interested to know some examples, please? >>>>>> >>>>>> Depth-first search of a binary tree. Top-down parsing. >>>>>> >>>>>> Anything that requires retracing a path thru a data structure. Without >>>>>> recursion you have to maintain a table to keep track of where you've >>>>>> been and where you're going. Recursion just handles it naturally. >>>>> >>>>> +1 >>>> >>>> In both cases a table is maintained, either through a manually >>>> programmed (trivial) table or through the auto-maintained call >>>> tree, either by a return stack, or, again, in the case of >>>> languages such as PL/M-86 that allocate local data statically, >>>> a human-maintained call structure. >>>> >>>> It seems to me that computer scientists wish for everything to >>>> be handed to them on a plate and baulk at the thought of >>>> minor diversions to provide some simple and trivial extra facitlites >>>> whereas real world programmers just get on with the job. >>> >>> I admit that there are probably cases where recursion is an >>> elegant solution to the problem. However, in my experience >>> such cases are few and far between. I've always considered >>> an obsession with recursion to be a hallmark of the CS weenie. >> >> Speaking as retired faculty, we tend to be better at giving the students >> tools than at showing them where they're appropriate... >> >> In the case of recursion, a problem a lot of new students have is >> understanding the difference between calling a function, and using a >> goto to get to the function and another goto to go back where you came >> from (I actually once had a student ask me what the difference was; he >> didn't have enough of a concept of abstraction, encapsulation, or >> organization for any answer in those terms to make the slightest >> sense). Simply not telling them about labels and gotos in the first >> class helps, but there's always one who figures it out on his own and >> turns in a bowl of amazing spaghetti for his second or third assignment. >> >> By the time they can get a simple recursive function to work, they have >> to have some sort of understanding of the notion of a function call >> being the same thing as turning a part of the problem over to somebody >> else to solve, and getting an answer back. So it's really helpful in >> teaching functions. >> >> Unfortunately, they also tend to come out of the experience with the >> idea that it's a great way to find the fibonacci sequence... >> > > If you use "dynamic programming" and cache the results of Fibonacci > calls, it can be quite efficient. When the Fibonacci function returns > a result or sub-result (say the fifth Fibonacci number), the result is > cached. Before any call to the Fibonacci function, the program first > checks to see if the result being sought... already exists in the > cache. If the result is in the cache, use the result instead of > calling the function. > > This prevents repetitiously calling of the Fibonacci function for any > one particular number. For example, if you have already called the > Fibonacci function for the tenth number... the result will be in the > cache. You never again need to call the Fibonacci function for the > tenth Fibonacci number. Of course. But in context it's clear I'm talking about a naive recursive implementation.
Technical Details
Message-ID:
<1bin6yfcxa.fsf@pfeifferfamily.net>Path:
mbox-mo1.pugleaf.net!n13-v6ni1050wmc.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mailReferences:
<874lisvjda.fsf@usenet.ankman.de> <fnammmFl3d5U4@mid.individual.net> <pep9gi$ssu$1@dont-email.me> <877enj7cme.fsf@usenet.ankman.de> <2111hdh5qbjo4o6ot3n9cuqfgk1pqdn8ck@4ax.com> <86ad7a17-fbd3-4056-98aa-91e1b38932ce@googlegroups.com> <1778842547.549582573.514335.peter_flass-yahoo.com@news.eternal-september.org> <-8-dnaDqYe0JXo_GnZ2dnUU78bmdnZ2d@giganews.com> <68034291-0143-4693-b8fe-755df7f87322@googlegroups.com> <PcqdnYC22cafaI7GnZ2dnUU78S3NnZ2d@giganews.com> <pf1188$q8f$3@dont-email.me> <358405364.549754306.026362.peter_flass-yahoo.com@news.eternal-september.org> <pf2rlv$kq0$1@dont-email.me> <1147666797.549800491.480189.peter_flass-yahoo.com@news.eternal-september.org> <fnkl60Fl3d5U10@mid.individual.net> <pf385t$mnk$1@dont-email.me> <pf3lbl02eqe@news4.newsguy.com> <1bfu22cqz1.fsf@pfeifferfamily.net> <pf4aud$e8p$1@dont-email.me>Show Full Headers
Complete Article Headers
X-Received: by 2002:adf:e84b:: with SMTP id d11-v6mr1726147wrn.24.1528148434441; Mon, 04 Jun 2018 14:40:34 -0700 (PDT) X-BeenThere: alt.folklore.computers@googlegroups.com Received: by 2002:a1c:f512:: with SMTP id t18-v6ls248062wmh.10.gmail; Mon, 04 Jun 2018 14:40:33 -0700 (PDT) X-Received: by 2002:a1c:30c3:: with SMTP id w186-v6mr275619wmw.2.1528148433732; Mon, 04 Jun 2018 14:40:33 -0700 (PDT) Path: mbox-mo1.pugleaf.net!n13-v6ni1050wmc.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Joe Pfeiffer <pfei...@cs.nmsu.edu> Newsgroups: alt.folklore.computers Subject: Re: The birth of BASIC Date: Mon, 04 Jun 2018 15:40:33 -0600 Organization: A noiseless patient Spider Lines: 85 Message-ID: <1bin6yfcxa.fsf@pfeifferfamily.net> References: <874lisvjda.fsf@usenet.ankman.de> <fnammmFl3d5U4@mid.individual.net> <pep9gi$ssu$1@dont-email.me> <877enj7cme.fsf@usenet.ankman.de> <2111hdh5qbjo4o6ot3n9cuqfgk1pqdn8ck@4ax.com> <86ad7a17-fbd3-4056-98aa-91e1b38932ce@googlegroups.com> <1778842547.549582573.514335.peter_flass-yahoo.com@news.eternal-september.org> <-8-dnaDqYe0JXo_GnZ2dnUU78bmdnZ2d@giganews.com> <68034291-0143-4693-b8fe-755df7f87322@googlegroups.com> <PcqdnYC22cafaI7GnZ2dnUU78S3NnZ2d@giganews.com> <pf1188$q8f$3@dont-email.me> <358405364.549754306.026362.peter_flass-yahoo.com@news.eternal-september.org> <pf2rlv$kq0$1@dont-email.me> <1147666797.549800491.480189.peter_flass-yahoo.com@news.eternal-september.org> <fnkl60Fl3d5U10@mid.individual.net> <pf385t$mnk$1@dont-email.me> <pf3lbl02eqe@news4.newsguy.com> <1bfu22cqz1.fsf@pfeifferfamily.net> <pf4aud$e8p$1@dont-email.me> Mime-Version: 1.0 Injection-Info: reader02.eternal-september.org; posting-host="75e449f9bb33901e1c64b36a3eb0c764"; logging-data="24495"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX1/+6K2AwrtfjTLUz/2R4TRw2Fn+NhC7qyQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cancel-Lock: sha1:vBFHy2hVF/v5uOMyTPvGQ/dpax8= sha1:I/dHzvSH1g9RMrrOidCJw27gORk= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit