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!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: How to get Ada to ?cross the chasm?? Date: Thu, 10 May 2018 14:16:09 +0300 Organization: Tidorum Ltd 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> <87y3gt6dhm.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net XXRxoDcPjSENb1FfsL6jzwqAmKzsSflZgV5uF+yfx/bwSOKQJt Cancel-Lock: sha1:oT22+ozKdJYm846POofvaLXyAY8= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <87y3gt6dhm.fsf@nightsong.com> Xref: reader02.eternal-september.org comp.lang.ada:52199 Date: 2018-05-10T14:16:09+03:00 List-Id: On 18-05-09 00:31 , Paul Rubin wrote: > Niklas Holsti writes: >>> x = 1 : 2 : 3 : x >> Can you construct such a list in Haskell without using and setting >> explicit references? > > If you mean writing the list without using x on both sides of the equal > sign, you could use a fixpoint combinator: > > Prelude Control.Monad.Fix> let f = fix ([1,2,3]++) > Prelude Control.Monad.Fix> take 20 f > [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2] > > But fix is written something like this: > > fix f = x where x = f x > > and there's an explicit reference there. Thanks, this explains it. > There's an argument for eliminating unrestricted recursion from > programming so that all functions must eventually return, ... > > http://www.jucs.org/jucs_10_7/total_functional_programming Interesting, especially the places where some appeal is made to quantitative termination (complexity) properties. The fact about the limitations of languages where all programs necessarily terminate, and the consequent need for a hierarchy of languages, were new to me. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .