From: Devin Mullins Date: 2005-09-12T12:26:52+09:00 Subject: Re: Array#[]= Trans wrote: >If it works like a case statement, the the last will never be reached. > > Yep. Shame on whomever wrote that code! :P >Also if this is just a helper, you probaby could do it now with a case >statement, let me see... > > > >Pretty simpe, if not quite as concise. > Yeah, I guess what I'm seeking is a concise way to write that. Maybe it's not deserving of its own construct, though. Can you think of a more general solution that gets half-way there? Maybe a pattern-matching thing akin to the way OCaml does case statements... def x(*args) case args when [] then ... when [a] then ... when [a,b] then ... else ... end end That is totally un-Ruby, of course, so, I dunno. > Also I reacall a "real" solution >to this somewhere --writen by an old school Japanese Ruby Hacker. But I >can't seem to track it down. Anyone recall? > > 'd be interested to hear. Thanks, Devin