Mercury (programming language): Difference between revisions

Content deleted Content added
Module names are separated by dots now.
No edit summary
Line 1:
'''Mercury''' is a [[Functional programming|functional/]] [[logic programming|logicallogic]] [[programming language]] based on [[Prolog]], but more usefulgeared fortowards real-worldpractical programmingapplications.
 
Mercury has several features intended for better [[software engineering]] than is possible with Prolog. It is [[compiler|compiled]] rather than interpreted, as is traditional for logic programming languagues. It features a sophisticated, strict [[Data type|type]] and mode system. Its authors claim these features andcombined with logic programming's abstract nature speeds writing of reliable programs. Mercury's module system enables division into self-contained units, a problem for past logic programming languages. (But note that several existing Prolog implementations also include module systems.)
 
Mercury is a more "pure", and therefore more [[Declarative programming|declarative]], language than Prolog, since it does not have "extra-logical" Prolog features like the "cut" (a Prolog construct which prevents [[backtracking]]) and [[imperative programming|imperative]] [[I/O]]. This makes the coding of sequential algorithms somewhat more cumbersome, but it makes automated program [[Optimization (computer science)|optimization]] easier.
 
Hello World in Mercury:
<pre>
:- module hello_worldhello.
 
:- interface.
 
:- import_module io.
 
:- pred main(io.state, io.state).
:- mode main(di, uo) is det.
 
:- implementation.
main(!IO) :-
 
io.write_string("Hello, World!\n", !IO).
main --&gt;
io.write_string("Hello, World!\n").
</pre>
 
(byadapted from Ralph Becket's [http://www.cs.mu.oz.au/research/mercury/tutorial/hello-worldbook/book.htmlpdf RalphMercury Beckettutorial] at the University of Melbourne):.
 
Mercury is developed at the [[University Of Melbourne]] Computer Science department under the supervision of [[Zoltan Somogyi|Dr. Zoltan Somogyi]].
 
Mercury is developed at the [[University Of Melbourne]] Computer Science department under the supervision of [[Zoltan Somogyi|Dr. Zoltan Somogyi]].
Unfortunately, the current Mercury implementation lacks user level documentation (only reference documentation exists). Thus it is almost unused outside the team of its creators.
 
Mercury is still highly experimental, and virtually unused outside the team of its creators.
==See also==
* [[functional programming]]
* [[logic programming]]
 
==External links==