Jeff Clites <[EMAIL PROTECTED]> wrote:
> I was thinking: Implementing tail calls seems easy;

I thought that too. So I did it ;)

$ time parrot  -j fact.imc 10000                  # [1]
maximum recursion depth exceeded

$ time parrot -Oc -j fact.imc 10000 >2            # [2]

real    0m0.635s

$ time ruby $(locate fact.rb) 10000 >1            # [3]

real    0m5.237s

$ diff 1 2
$ ls -l 1
-rw-r--r--   1 lt       users       35661 Nov 11 18:01 1

I've to clean it up a bit, though.

leo

[1] default recursion limit is 1000
[2] -Oc turns on tailcall optimizations, unoptimized Parrot build
[3] this is an iterative version of factorial

leo

Reply via email to