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!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: Studying and Maintaining GNAT, Is There Any Interest in a New Group? Date: Wed, 29 Aug 2018 23:29:33 -0700 Organization: A noiseless patient Spider Message-ID: <87k1o81i5u.fsf@nightsong.com> References: <309225242.556906218.575482.laguest-archeia.com@nntp.aioe.org> <2145221813.556924687.162377.laguest-archeia.com@nntp.aioe.org> <3892c779-2924-405c-b88d-19389fc5ba3e@googlegroups.com> <1ceec6d8-c5c4-49b1-9808-a3580bba3f8e@googlegroups.com> <87y3cpdgds.fsf@nightsong.com> <1230377626.557216184.473076.laguest-archeia.com@nntp.aioe.org> <87o9dl0zi7.fsf@nightsong.com> <510161226.557301201.553770.laguest-archeia.com@nntp.aioe.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="4fd9d3b8716275f3769773c0633f0b32"; logging-data="2515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9YPZJI3A+KSTJ3EOHI+8x" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cancel-Lock: sha1:dnC7/ItPyOii1xJcfCzJvZiT0jQ= sha1:ys8BTmJ8EMi0q7eXhIvjTaKIaXI= Xref: reader02.eternal-september.org comp.lang.ada:54295 Date: 2018-08-29T23:29:33-07:00 List-Id: Luke A. Guest writes: > My issue with FP is forcing recursion everywhere, that’s really > unnatural and very difficult to think in, it’s natural for some > algorithms but not all. I'm not sure what you want to use instead. Generally in Haskell one doesn't use much explicit recursion but instead uses functions like map and fold, to operate on collections all at once. If you really want to use something like a while-loop or for-loop, Ocaml has those: https://ocaml.org/learn/tutorials/if_statements_loops_and_recursion.html#For-loops-and-while-loops but it's a pretty safe bet that they are just syntactic sugar for recursive closures. Haskell has some similar library functions that are useful now and then: http://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html Normally though, you wouldn't write a traditional imperative loop in a functional language, because of the mutating index variable. There are alternate idioms and you get used to them.