Hi everybody!

I have the following code:

| iter fact |
iter := [:n :product |
    (n <= 0) ifTrue:  [ product ]
             ifFalse: [ iter value: (n - 1) value: (product * n) ]].

fact := [:n | iter value: n value: 1].

According to the Windows Task Manager, gst memory consumption grows up
with the argument passed to fact, e.g.

st> fact value: 5000.

makes gst to use ~80 MB of RAM on my machine.

Does the GNU Smalltalk support tail recursion like Scheme? Or simply
my code is incorrect....

With best regards,
Dmitry


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to