Section 1.2.1 in SICP:
http://mitpress.mit.edu/sicp/full-text/book/book-Z -H-11.html#%_sec_1.2.1... programming is an art......maybe one that C++ does not force you
to learn...:->
Well,
I tried the code and on my computer it ran in about
10 seconds (ocamlc/bytecode) and in about 7.6 seconds (ocamlopt/machine code).
So, what's the problem this discussion is about?
Erlang I have installed, but never seriously used...
http://ocamlp3l.inria.fr/eng.htm
Ciao, sdnin
And with social interaction, nobody has the chance to lie.
;-)
(well some bodies maybe...?)
Section 1.2.1 in SICP: http://mitpress.mit.edu/sicp/full-text/book/book-Z -H-11.html#%_sec_1.2.1 ... programming is an art... ...maybe one that C++ does not force you
to learn... :->
Well, ok, it's not 7x3 in the original code.
But after looking into the code in more detail,
I saw that many (the most (nearly all (all?!)))
recursive functions aren't tail-recursive.
With such simple recursive approaches
it is no wonder that the program is slow.
Try to read SICP and learn to write tail-recursive
code, then the code will be reasonably fast!
At least the functions that will be called often
should be rewritten into tailrec functions.
ocamlprof will help to find out, which functions
are called most often.
Well, I tried the code and on my computer it ran in about 10 seconds (ocamlc/bytecode) and in about 7.6 seconds (ocamlopt/machine code). So, what's the problem this discussion is about?