Celsius to Fahrenheit - Mercury Typing CST Test
Loading…
Celsius to Fahrenheit — Mercury Code
Converts Celsius to Fahrenheit.
:- module tempconv.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
main(!IO) :-
C = 25.0,
F = C * 9.0/5.0 + 32.0,
io.write_float(F, !IO), io.write_string("\n", !IO).Mercury Language Guide
Mercury is a purely declarative logic programming language with strong typing, determinism analysis, and a focus on reliability and performance. It is designed for building large-scale, maintainable, and efficient logic programs while avoiding common pitfalls of traditional Prolog systems.
Primary Use Cases
- ▸Logic-based and symbolic programming
- ▸Constraint solving
- ▸Knowledge representation
- ▸Formal verification and theorem proving
- ▸Academic research and teaching
Notable Features
- ▸Purely declarative semantics
- ▸Strong, static type system
- ▸Mode and determinism checking
- ▸High-performance compiler
- ▸Separation of logic and control flow
Origin & Creator
Mercury was created in the mid-1990s by Zoltan Somogyi, Fergus Henderson, and Thomas Conway at the University of Melbourne, building on ideas from Prolog but with stricter type and mode systems.
Industrial Note
Mercury is used in academic research, formal verification, symbolic computation, and complex rule-based systems. While not mainstream, it is highly valued in areas requiring highly reliable logic programs.