Hi Thorsten, > since I just wrote a little Wiki article about recursion in PicoLisp, I > would be curious about how recursion performs in comparison to iteration > in PicoLisp.
OK, let's try. If I run this: # Recursive (bench (do 1000000 (let (N 100) (recur (N) (if (=0 N) 1 (* N (recurse (dec N))) ) ) ) ) ) # Iterative (bench (do 1000000 (let N 1 (for I 100 (setq N (* I N)) ) N ) ) ) # Simple (bench (do 1000000 (apply * (range 1 100)) ) ) then I get: 13.161 sec 7.331 sec 7.413 sec -> 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 So the recursive version takes about twice as long as the other two. > The notion of 'tail-recursion' does not have any meaning in an > interpreted language like PicoLisp, since its only for compiler > optimizations -right? Yes. ♪♫ Alex -- UNSUBSCRIBE: mailto:firstname.lastname@example.org?subject=Unsubscribe