Edit: Also, apologies for the possibly ninja edit. This is ultimately somewhat silly. I am not going to lie and say that the these are easily readable. I fully cede that this could just be a training thing. I picked this particular example because I had fun with it using the DLX algorithm. Which is admittedly far above my understanding in many ways. :) Just the naive recursive solution was much easier to read, but much much slower to execute. To the point that it was laughable. (If interested, I can post my code.)
Also, I don't think that Haskell, OCaml, (or Prolog) are that much declarative: They have a very clear evaluation model, which you need to know in order to write any code. They also have debuggers as a result.
Regardless, I do apologize for the noise.
C (http://rosettacode.org/wiki/N-queens_problem#C)
Program 1 (compiled with gcc -O3 c1.c -o bin/c1)[0]
Program 2: (compiled with gcc -O3 c2.c -o bin/c2)[1]Same as above, second code listing (faster while still readable,excluded unreadable fastest c version)
Haskell (http://rosettacode.org/wiki/N-queens_problem#Haskell)Program 1 (modified to do 8 queens like the c versions, compiled with: ghc -O2 -threaded haskell2.hs -o bin/haskell2)[2]
Program 2 (modified to do 8 queens like the c version, compiled with: ghc -O2 -threaded haskell2.hs -o bin/haskell2)[3] (word of warning, this program is only 52% efficient according to ghc and has a lot of optimization that could be done) Note that the fastest Haskell solution was also the shortest by quite a bit. Are you convinced yet?EDIT: Found an ATS solution, but I'm not setup to compile it: http://www.ats-lang.org/SERVER/MYCODE/Patsoptaas_serve.php?m...
0: C, solution 1
1: c solution 2 2: Haskell solution 1 (comments stripped out for comparison) 3: Haskell solution 2