From: Robert Klemme Date: 2008-09-08T20:47:24+09:00 Subject: Re: Ruby tailcall optimizes? 2008/9/8 cnb : > Hmm this was a nice surprise. it seems Ruby does tailcall- > optimization? It doesn't. 13:51:03 ~$ ruby -e 'def t(a)a>0?t(a-1):a;end;t 1_000_000' -e:1:in `t': stack level too deep (SystemStackError) from -e:1:in `t' from -e:1 13:51:39 ~$ ruby19 -e 'def t(a)a>0?t(a-1):a;end;t 1_000_000' -e:1:in `t': stack level too deep (SystemStackError) from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' ... 7264 levels... from -e:1:in `t' from -e:1:in `t' from -e:1:in `t' from -e:1:in `
' > Is there a way to have optional arguments in Ruby? Did you read the documentation? robert -- use.inject do |as, often| as.you_can - without end