[Haskell-cafe] Wumpus World
Richard A. O'Keefe
ok at cs.otago.ac.nz
Thu Mar 27 20:59:17 EDT 2008
On 27 Mar 2008, at 8:25 pm, Robert Wills wrote:
> This might also be relevant:
> http://web.engr.oregonstate.edu/~erwig/zurg/
But note that the Prolog code that they compared against was, um,
let's put this kindly, seriously naive. For example,
(a) it has 36 SLOC. You can do it naturally in 20.
(b) it has 8 predicates. You can do it naturally in 4.
(c) it does lots of list munching, and that inefficiently.
You can do it much more naturally with the only list being the
solution.
Indeed, a very minor rewrite from the natural code gives you a
Prolog
program where NO heap storage is allocated except the list of
move names.
(d) It generates candidate solutions and then rejects ones that take too
long. It is easier and more natural to reject over-time paths
before
extending them to solutions, so the Prolog code they used for
comparison is *structurally* inefficient.
30 years ago people were writing papers showing that Lisp was better
than
very badly written Prolog. Now they are writing papers showing that
Haskell
is better than very badly written Prolog. How things have changed!
NOT.
Also note that the paper says
"The most important feature of Haskell that supports
[the impression that Haskell is good at this kind of
thing]
is the availability of multi-parameter type classes..."
and that Haskell 98 had no multi-parameter type classes, which are
a pretty advanced part of the language for beginners to understand.
More information about the Haskell-Cafe
mailing list