I learned Mercury from Ralph Becket's Mercury tutorial (which is the first link under the documentation section of the site). There are code examples throughout the book that show how the language can be used.
Mercury started out as a subset of Prolog, and is still very Prolog-like. The Mercury compiler is written in Mercury, and that's how it was originally bootstrapped. So anyone that knows Prolog should feel reasonably comfortable writing code in Mercury.
One major difference is the type system, which feels more like Haskell than Prolog (where everything is an atom). Another is the way it handles predicates/functions that can generate multiple outputs - there are no cuts (!), and if a predicate can generate multiple values then it should be declared as such. These type and mode declarations allow the compiler to generate much more efficient code than a Prolog interpreter.
>> One major difference is the type system, which feels more like Haskell than
Prolog (where everything is an atom).
Everything in Prolog is a "term", that can be a predicate, a constant or a
variable. Constants are predicate symbols (called "functors"), numbers, or
character strings of the form [a-z][A-Za-z0-9_]& (where & is the Kleene star that I don't know how to enter in HN comments), or any string enclosed in
single quotes, ''. Variables are upper case letters. And predicates are atoms
followed by a vector of terms in parentheses, their arguments.
There is often confusion on the matter, because all constants are considered
"atomic" and people sometimes use the term "atom" to refer to all atomic
constants (where the distinction is clear from the context; allegedly).
However, numbers are not atoms, so the following is true:
?- atomic(1).
true.
While the following, false:
?- atom(1).
false.
There is even more confusion sown by the different use of first-order logic
terminology in Prolog. For example, in FOL, a "term" is a constant, a variable
or a function given as an argument of a predicate, while an "atom" is a
predicate symbol followed by a vector of arguments in parentheses. Perhaps the
difference is partly due to the fact that it is ground atoms (i.e. without
any variables) that are the most often discussed in FOL, and since constants
are ground, they end up being called "atoms" in Prolog.
Then there's the fact that, in Prolog, it's impossible to distinguish between
a constant and a predicate symbol or, indeed, between predicates with 0
arguments and constants. Perhaps as a result of this, Prolog accepts
predicates as arguments to predicates - since it can't distinguish between
0-arity predicates and constants, it has to accept predicates as arguments,
but then, it has to accept n-arity predicates as arguments. Which means that,
in principle, it's a FOL language, but in practice, it is actually
second-order. Maybe then the reason why predicates are known as "terms" in
Prolog is because they can, actually, take the place of terms. But, I don't
know for sure.
Anyway, there's a lot of terminlogical confusion around Prolog :)
Mercury started out as a subset of Prolog, and is still very Prolog-like. The Mercury compiler is written in Mercury, and that's how it was originally bootstrapped. So anyone that knows Prolog should feel reasonably comfortable writing code in Mercury.
One major difference is the type system, which feels more like Haskell than Prolog (where everything is an atom). Another is the way it handles predicates/functions that can generate multiple outputs - there are no cuts (!), and if a predicate can generate multiple values then it should be declared as such. These type and mode declarations allow the compiler to generate much more efficient code than a Prolog interpreter.