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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9e7db243dfa070d7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed.straub-nv.de!news-2.dfn.de!news.dfn.de!news.uni-stuttgart.de!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 30 Oct 2010 14:15:48 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Do people who use Ada also use ocaml or F#? References: <4aacf4ab-6e56-421d-8381-26f8aeb5c840@p1g2000yqm.googlegroups.com> In-Reply-To: <4aacf4ab-6e56-421d-8381-26f8aeb5c840@p1g2000yqm.googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4ccc0c74$0$6772$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 30 Oct 2010 14:15:48 CEST NNTP-Posting-Host: 85ad7e67.newsspool3.arcor-online.net X-Trace: DXC=DETX7;U?V17]E=H1Q9`787McF=Q^Z^V384Fo<]lROoR18kFejV8;Bi1XSQ]b49n=c7Xb^NUl3 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:15938 Date: 2010-10-30T14:15:48+02:00 List-Id: On 10/30/10 3:32 AM, Chad R. Meiners wrote: > In many cases, the repetition of type assertion is a > desirable sanity check; however, ML-based languages allows for the > functionally to be more efficiently expressed in some cases. Take > pattern matching and automatic generalization for an example > > let reduce foo = > let rec go carry = function > | [] -> carry > | value :: tail -> go (foo carry value) tail > in go Interestingly, Guido van Rossum has let list comprehensions into Python 3 but has reduced `reduce` in rank. He reminds programmers that Python is a programming language and that they should please use a for loop! ;-) Indeed, leaving currying (and fun?) aside, one wouldn't necessarily want to pass ever new lists around: generic type T is private; Zero : in T; with function Op (Left, Right: T) return T; type Index is (<>); with function Element (Position : Index) return T; function Reduce (First, Last: Index) return T; function Reduce (First, Last: Index) return T is Result : T; begin Result := Zero; for K in First .. Last loop Result := Op (Result, Element(K)); end loop; return Result; end Reduce; The odd thing is that the type of functions in functional languages is essentially composite. Whereas the idea of a function is one thing! Hence I'd expect it worth a type that is not just a consequence of the type of arguments in the function table's columns (such as 'a -> 'b -> 'a). Is functional abstraction not more than a cross product of data? But I understand that mathematical paper writing suggest a formalism for expressing ideas that is closer to the mathematical ideal of not stating what is deemed obvious in the target group (and acceptable, viz. expected and fashionable). Alas, results usually need to be re-worked into simply constructed and memory-efficient programs for real computers. Even when using a functional language... :-) -- Georg