On 07.11.2010 05:41, John Mair wrote: >> and a solution flow similar to >> >> ruby> def WHILE(cond) >> | return if not cond >> | yield >> | retry >> | end >> nil >> ruby> i=0; WHILE(i<3) { print i; i+=1 } > > This WHILE loop will not work because the condition is only evaluated > once. If you want it to work you need to turn the condition into a > lambda, like so: > > def WHILE(cond) > loop do > return if !cond.() > yield > end > end > > and use like this: > > i = 0 > WHILE(->{i< 3}) { puts i; i+=1 } Where's the point in doing this when there are "while" loops already built into the language? I still think we first need to get the math correct before we can come up with solutions. Formulas I have seen in this thread look like they could be solved with some simple transformations and do not need any nested intervals or similar approximation algorithms. So far I find the problem description quite confusing. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/