help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Does the GNU Smalltalk support tail recursion?


From: Dmitry Matveev
Subject: [Help-smalltalk] Does the GNU Smalltalk support tail recursion?
Date: Mon, 21 Sep 2009 10:10:34 +0400

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]