From: "David A. Black" Date: 2005-01-31T22:34:04+09:00 Subject: Re: nil question Hi -- On Mon, 31 Jan 2005, William James wrote: > Austin Ziegler wrote >> you can also do: >> >> puts "yes" if x.between?(-5, 9) >> puts "yes" if (-5..9).include?(x) > > But that's not as readable as -5 < x < 9, which is how it is written > for humans in algebra. > > In Icon, comparisons succeed or fail, they don't return true or false. > So it works this way (if x==0): > (-5 < 0 ) succeeds and produces 0 > (0 < 9 ) succeeds and produces 9 > > 1 < x < 9 > (1 < 0) fails > > -5 < x < -15 > (-5 < 0 ) succeeds and produces 0 > (0 < -15 ) fails > > So in Icon, a < x < b means exactly what it does in algebra. > > Matz and many Ruby gurus think that Ruby incorporates the best > features of preceding languages (e.g., Awk, Perl, Python, Smalltalk). > But how many of these people ever used Icon? Ruby does incorporate ideas from many languages, but that doesn't mean that every existing language has a quota of space in Ruby that it gets to fill :-) Nor is Ruby's perspective on things always filtered through other programming languages. For example, the a < x < b idea has been discussed before, on the question of its own merits and how it fits into Ruby, rather than specifically because it's in Icon (or Python or elsewhere). (See archives and this thread for more.) David -- David A. Black dblack@wobblini.net