Article View: alt.folklore.computers
Article #623708Re: The birth of BASIC
From: Andrew Swallow
Date: Tue, 05 Jun 2018 14:17
Date: Tue, 05 Jun 2018 14:17
90 lines
6945 bytes
6945 bytes
On 04/06/2018 22:40, Joe Pfeiffer wrote: > 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. > The same way you only do a factorial calculation once. There after you look it up. After 32! we hit overflow so the array was short.
Technical Details
Message-ID:
<FJKdnSoT6OYaBovGnZ2dnUU78aXNnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!n13-v6ni5067wmc.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweak.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!buffer2.nntp.ams1.giganews.com!news.giganews.com.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> <1bin6yfcxa.fsf@pfeifferfamily.net>Show Full Headers
Complete Article Headers
X-Received: by 2002:adf:ed8a:: with SMTP id c10-v6mr1428210wro.28.1528208265488; Tue, 05 Jun 2018 07:17:45 -0700 (PDT) X-BeenThere: alt.folklore.computers@googlegroups.com Received: by 2002:adf:fd05:: with SMTP id e5-v6ls335224wrr.4.gmail; Tue, 05 Jun 2018 07:17:44 -0700 (PDT) X-Received: by 2002:adf:abed:: with SMTP id s100-v6mr2028109wrc.0.1528208264732; Tue, 05 Jun 2018 07:17:44 -0700 (PDT) Path: mbox-mo1.pugleaf.net!n13-v6ni5067wmc.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweak.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!buffer2.nntp.ams1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 05 Jun 2018 09:17:43 -0500 Subject: Re: The birth of BASIC Newsgroups: alt.folklore.computers 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> <1bin6yfcxa.fsf@pfeifferfamily.net> From: Andrew Swallow <am.sw...@btinternet.com> Date: Tue, 5 Jun 2018 15:17:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1bin6yfcxa.fsf@pfeifferfamily.net> Message-ID: <FJKdnSoT6OYaBovGnZ2dnUU78aXNnZ2d@giganews.com> Lines: 90 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-ndQSeNVodEJK2gMwej9ze6WNLchzkqJjtfIGAuiZf4qicPJuBbRqiTEVw+pCdNNGP+sl4eYY5p0gzWm!XwCgc0CoSiV6M8vBNQHsI4DPTQNGjHL+nlxaqKMvKEtNPTePjM+JQkC44ctWepmIik61NO2HuDI= X-Complaints-To: ab...@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Bytes: 6490 X-Original-Bytes: 6397 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit