[EMAIL PROTECTED] wrote
> In fact this sort of generate-and-test cryptarithm solvers is
> particularly simple in C++ because:
> - It does not require any memory management.
> - A library function for permutations happens to be available.
> - The computational complexity of the example is still small enough for
> a brute-force generate-and-test approach. A more intelligent solution
> is not needed.
That C++ has a library function for permutations, shouldn't be put on
C++'s downside, but on its up ..
The other two points also occured to me to. So why not challenge C++
to show a generic (and efficient !) cryptarithm solver ... I can do
that easily in Prolog or even better in CLP. People more fluent in
Haskell can do it there.
The problem with these small problems is that once written in a
declarative way - even the generic cryptarithm solver - (be it Haskell,
Mercury, Clean or Prolog) it is usually very easy to rewrite them in
C(++) and get better speed. Actually, the best way to get the fastest
program to solve any given cryptarithm solver, would probably be to
write a compiler from cryptarithm problems to C - writing that
compiler would be a piece of cake in a declarative language and a can
of worms in C(++).
It is only the larger, complex problems that will show that they can
be tackled with success in a declarative way and hardly in C(++), but
you need at least a month trying to do it both ways, before you
discover that.
Speed is not the only issue - feasability is an issue as well.
Cheers
Bart Demoen