[Shootout-list] Ackermann

Jon Harrop jon@ffconsultancy.com
Fri, 17 Jun 2005 20:23:28 +0100


On Friday 17 June 2005 19:41, you wrote:
> One vote for disallowing this - it should go as an interesting alternative.

Hehe. :-)

The next example is this, the C++ implementation of Sebastien's implicit-ode 
benchmark:

http://shootout.alioth.debian.org/sandbox/benchmark.php?test=implicitode&lang=gpp&id=0&sort=fullcpu

Now, I think this benchmark is great precisely because it is a practical 
example of C++ templates being useful for partial specialisation, i.e. it 
uses the same approach as the "cheating" ackermann implementation.

My answer: allow compile time precomputation but design the tasks such that it 
is not, in general, of benefit (e.g. definitely don't compute a constant - 
pidigits!) and keep the C++ implementation of implicit-ode because it is a 
great practical example of when partial specialisation is of benefit.

Note that there is no clear distinction between passing a function as a 
template parameter in C++ and using a higher-order function in OCaml except 
that C++ necessarily does it at compile time and OCaml does it at run time.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists