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!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: If not Ada, what else... Date: Wed, 29 Jul 2015 08:41:15 -0700 Organization: A noiseless patient Spider Message-ID: <87si87nf8k.fsf@jester.gateway.sonic.net> References: <87k2u96jms.fsf@jester.gateway.sonic.net> <06f8a6f9-d219-4d40-b9ac-8518e93839bd@googlegroups.com> <87y4io63jy.fsf@jester.gateway.sonic.net> <7a29d3e9-d1bd-4f4a-b1a6-14d3e1a83a4d@googlegroups.com> <87mvz36fen.fsf@jester.gateway.sonic.net> <2215b44f-8a89-47c6-a4c4-52b74d2dac45@googlegroups.com> <9e492c82-868d-43d3-a18a-38274400e337@googlegroups.com> <40184feb-4053-4ac3-8eaa-c3bd9cd8a77c@googlegroups.com> <10272577-945f-4682-85bc-8ad47f3653ae@googlegroups.com> <87si8i81k2.fsf@atmarama.net> <8076cbd0-2655-4c98-b70e-cb5f0c32e4ba@googlegroups.com> <5e6cb30b-5f8c-4fed-969e-3941315ecba0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="d4217d68945dedf510265c644f2a7daa"; logging-data="23104"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3VkNF4eDZ3hRs494AsoB+" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:Lq9smEo2x8QflTvfQQXVCTWQ2a4= sha1:LviHflnqH5EnaX+fGiGYHupzLVg= Xref: news.eternal-september.org comp.lang.ada:27129 Date: 2015-07-29T08:41:15-07:00 List-Id: EGarrulo writes: > Why wouldn't Ada be good for hacking? The only drawback I can see > does not relate to the language itself, but to the lack of flexible > standard libraries. Lack of garbage collection (at least in most implementations) is the first thing that comes to mind. > Ada supports higher- order functions, but it has nothing like the > standard library Prelude in Haskell, or the STL in C++. Ada doesn't have meaningful HOF's in the sense of Haskell, afaik. But I thought Ada generics were like the C++ STL? > Why wouldn't Ada be good for prototyping? I would say that the > opposite is true, because many recurring abstractions can be > conveniently expressed; and the compiler lets you code mindlessly, > with the certainty that any stupid mistake will be fixed before the > program runs. 1) no garbage collection, 2) recurring abstractions like dynamically growable lists, strings, dictionaries, etc. might be doable in Ada but are built into Haskell, Python, etc. > I have prototyped software in Python and I have found it draining: the > program runs until the interpreter finds a stupid mistake and -- boom! > -- you have to fix it and restart again. Right, you have to code in a style where you expect that to happen, but it's fairly easy to develop that. > I am sure that had I used Ada instead, I would have completed my > prototypes much earlier. I'd be interested in seeing Ada solutions to a few of the earlier Euler problems, let's say selected from the first 25. You could either look at the problems and pick a few. Or alternatively, pick a number N between 1 and 25 before looking at the problems, and then do problem number N. Or even simpler: print a list of the first 100 primes. This is 3 lines of code in Haskell, see the illustration at the top of www.haskell.org . Here is an exercise that is easy in Haskell but surprisingly tedious in languages like Ada: a number is "5-smooth" or "Hamming" if it has no prime factors greater than 5. So 10, 12, and 15 are 5-smooth but 11, 13, and 14 are not. The first 20 Hamming numbers are: [1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36] I was going to ask for the millionth such number, but you need arbitrary precision arithmetic for it. So, what is the 10000th such number? That one fits in 64 bits, but is not really feasible to reach by counting.