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,b3f07bd1ad77d438 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: The state of functional programming Date: Thu, 29 Jul 2010 23:46:54 +0300 Organization: Tidorum Ltd Message-ID: <8be7luFbvaU1@mid.individual.net> References: <2adc4d8d-210e-429c-8188-9b1e99c2718e@d17g2000yqb.googlegroups.com> <1oubrlamjqe8q$.bdwkb9i7ys6b$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net rVfT0tOVQaiIxLnev84zCw2F2OgVXQYJIdrOjxt6LLQ6j1yz1x Cancel-Lock: sha1:BmUOEI/St6APYu5mARF/0d2z6ic= User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) In-Reply-To: Xref: g2news1.google.com comp.lang.ada:12691 Date: 2010-07-29T23:46:54+03:00 List-Id: Warren wrote: > Dmitry A. Kazakov expounded in > news:a3iznu9uq49d$.1m9cupr81yhut$.dlg@40tude.net: > >> On Thu, 29 Jul 2010 15:20:48 +0000 (UTC), Warren wrote: > .. >>> I think you missed my point - perhaps it wasn't expressed >>> clearly. >>> >>> As I understand it, a FP tries to determine conclusions >>> from a universe of facts, given some inputs. For smaller >>> problems this can be _exhaustively_ analyzed and results >>> obtained. >> And so does any declarative language. You declare some facts in >> whatever form (as relations, as connections of blocks etc, for that >> matter, as types in a strongly typed languages like Ada). The system >> infers from them some executable code. > > No, there is a big difference here. > > In a non-FP language (Ada), you can solve _any_ problem so long > as you code it (you are coding the "how"). IOW, you have > solved the problem and specified it in code. > > In FP, you define the "problem" (instead) and require from > it a solution. But FP cannot always solve that "problem". Warren, I think your description or understanding of FP matches "logic programming" or "constraint programming" rather than "functional programming". FP programs do specify "how" to compute a solution, although the FP compiler or interpreter may have to transform the "how" in smart ways to make it computable on resource-limited machines -- for example, by converting tail recursion to iteration, or by using lazy evaluation to avoid infinitely large intermediate results. Proving termination of functional programs is similar to proving termination of recursive imperative programs. It is in logic programming and constraint programming that the programmer enters facts, rules, and a goal, and the program searches for solutions (proofs or realisations of the goal) in some way that is not explicitly encoded in the program. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .