From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to get Ada to ?cross the chasm?? Date: Fri, 4 May 2018 18:29:17 -0500 Organization: JSA Research & Innovation Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <87k1su7nag.fsf@nightsong.com> <87po2la2qt.fsf@nightsong.com><87in8buttb.fsf@jacob-sparre.dk> <87wowqpowu.fsf@nightsong.com><16406268-83df-4564-8855-9bd0fe9caac0@googlegroups.com><87o9i2pkcr.fsf@nightsong.com> <87in88m43h.fsf@nightsong.com><87efiuope8.fsf@nightsong.com> <87lgd1heva.fsf@nightsong.com> <87zi1gz3kl.fsf@nightsong.com> Injection-Date: Fri, 4 May 2018 23:29:18 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="25537"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:51993 Date: 2018-05-04T18:29:17-05:00 List-Id: "Paul Rubin" wrote in message news:87zi1gz3kl.fsf@nightsong.com... > "Randy Brukardt" writes: >> I don't see anything "cyclic" or "self-referential" here. This is just a >> set >> of lists, and there is nothing particularly interesting about them (in >> partcular, there are *no* references involved in a list unless you need >> to >> keep a reference to a particular element, certainly doesn't happen here). > > This list contains a reference to itself: > > x = 1 : 2 : 3 : x And is illegal in any reasonable programming language... ;-) > If you try to print it, you'll see "1,2,3,1,2,3,1,2,3,1,2,3..." ad > infinitum until you interrupt the program. It is infinitely long, but > occupies a finite amount of memory. If you say so. I can't see any sensible way to implement such a thing; indeed I would have said it was impossible to implement but apparently you have an example to the contrary. ... >> Ergo, the underlying implementation of the Haskell code has to do >> something like that in order to figure out the answers. (There's no >> free lunch. :-) > > Yes, that's exactly right: the burden is moved from the application > programmer to the language implementation. True, but only if the problem actually matches the language implementation. A language like Ada that is built around readability and reuse allows one to build things once and use them forever. You're not stuck to just what the implementation can do. > But that Hamming number code isn't particularly mysterious. Says you. Lists of numbers are not a technique I would think of to do anything (partly because it would be so horribly inefficient). > Back in the day, > programmers would learn techniques like hash tables, recursion, etc.; > and then when given a problem they would either 1) see a solution from > techniques they knew; or 2) not immediately see a solution and have to > spend more time thinking, studying new techniques or whatever. What day was this? I've been programming 40+ years and don't remember any time when the average programmer thought about anything. Generally, they just started throwing code at the problem until it was solved or the boss gave it to someone else. ;-) That minority of us that engineer software do think about our code before we start, but the effort is put on abstraction and organization - the actual solution is almost irrelevant to that. Real problems are much larger and complex than any simple technique could be used to solve anyway. ... > The picture I'm trying to convey is that functional programming brings > some new techniques that (like hash tables) let you easily solve certain > problems once you know the tricks, that would be hard to solve > otherwise. I agree with this, but the problem is the majority of such problems aren't realistic in the first place. (Who cares about Hamming numbers?) And most of the other techniques can be used just as well in Ada (recursion, for instance; the map containers provide hash tables, etc.). Once you get the stuff where you need lambdas with closures, you're just writing tricky code that only a few (if any) will understand. (Ada is all about building long-lived programs; I haven't started a new program in quite a few years, just improving existing ones.) ... > If you like a tool and see a problem you can use it on, why > would you look for ways to *not* use it? ...but you also have to figure how that fits in with the entire system. Pretty much no one is solving simple stand-alone problems. It's a lot harder to debug a program that uses a whole bunch of different languages that barely work together. You might have one problem that actually would solve well in Haskell, but the entire system has dozens of problems and many of them aren't likely to be functional in nature (like the GUI to talk to the system). In any case, this is an Ada forum and there isn't point about talking about other languages here, other than to point out how Ada is better. ;-) Randy.