By way of a very brief example of Miranda style, here is a definition of the list of all prime numbers (an infinite data structure) using the sieve of Eratosthenes
primes = sieve [2..]
where
sieve (p:x) = p : sieve [n | n<-x ; n mod p > 0]
The expression in square brackets is a `list
comprehension' - it means list of n such that n drawn from
x and n not divisible by p. The test for divisibility uses
mod, the remainder operator. For comparison here is
the solution in
Java.
The Miranda system provides a self-contained interactive programming environment. The Miranda compiler works in conjunction with a screen editor (which can be vi or another editor of the user's choice). The type system enables a high proportion of semantic errors to be detected at compile time.
There is an online reference manual and a built in `make' feature which automatically keeps object code files up-to-date with their sources. The compiler generates an intermediate code based on combinatory logic, which is executed by a fast interpreter.
Research Software Limited was awarded a British Computer Society medal for the design of the Miranda system (BCS Awards, 1990).