Why is Ruby NOT tail recursive?

Discussion in 'Ruby' started by Laza, Mar 1, 2004.

  1. Laza

    Laza Guest

    I have just been reading a chapter on how to implement tail-recursiveness
    in Lisp, and it seems simple enough. Why does not Ruby do it?

    Thanks,

    -Laza
    http://lazax.com/blog
    Laza, Mar 1, 2004
    #1
    1. Advertising

  2. Hi,

    In message "Why is Ruby NOT tail recursive?"
    on 04/03/01, Laza <> writes:

    |I have just been reading a chapter on how to implement tail-recursiveness
    |in Lisp, and it seems simple enough. Why does not Ruby do it?

    Just because it was too hard to implement tail recursion with the
    current interpreter.

    matz.
    Yukihiro Matsumoto, Mar 1, 2004
    #2
    1. Advertising

  3. Laza

    John Carter Guest

    On Mon, 1 Mar 2004, Laza wrote:

    > I have just been reading a chapter on how to implement tail-recursiveness
    > in Lisp, and it seems simple enough. Why does not Ruby do it?


    It would be a nice to have, but on the other hand, converting a tail
    recursive call to a while loop is usually a very easy refactoring to make
    by hand.


    John Carter Phone : (64)(3) 358 6639
    Tait Electronics Fax : (64)(3) 359 4632
    PO Box 1645 Christchurch Email :
    New Zealand

    The universe is absolutely plastered with the dashed lines exactly one
    space long.
    John Carter, May 13, 2004
    #3
  4. John Carter wrote:

    > On Mon, 1 Mar 2004, Laza wrote:
    >
    >
    >>I have just been reading a chapter on how to implement tail-recursiveness
    >>in Lisp, and it seems simple enough. Why does not Ruby do it?

    >
    >
    > It would be a nice to have, but on the other hand, converting a tail
    > recursive call to a while loop is usually a very easy refactoring to make
    > by hand.


    That question might be a candidate for the FAQ, wouldn't it?
    The answer is here:
    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/94033

    Happy rubying

    Stephan
    Stephan Kämper, May 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    862
    Mark Rae
    Dec 21, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,762
    Smokey Grindel
    Dec 2, 2006
  3. n00m
    Replies:
    12
    Views:
    1,102
  4. ssecorp
    Replies:
    4
    Views:
    362
  5. Terry Michaels

    Tail Call Optimization (Tail Recursion)

    Terry Michaels, Apr 18, 2011, in forum: Ruby
    Replies:
    16
    Views:
    304
    Robert Klemme
    Apr 20, 2011
Loading...

Share This Page