From: sur max Date: 2007-02-16T04:05:23+09:00 Subject: Re: is it behaving strange ? ------=_Part_59522_20351716.1171566292908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline if we even consider it this way .... *a = 9 a << 5 i mean a = [9,5] and now considering it as... a # => [9,5] *a # => 9,5 --- (on assignment) so the following should be true b = a # => [9,5] ----- true b = *a # => [9,5] ----- true , b is re-wrapping 9,5 as [9,5] b = [a,6] # => [[9,5],6] ---- true, naturally b = [*a,6] # => [9,5,6] ----- false, compile error b = *a,6 # => [9,5,6] ----- false, compile error On 2/16/07, dblack@wobblini.net wrote: > > Hi -- > > On Fri, 16 Feb 2007, Jacob Fugal wrote: > > > On 2/15/07, sur max wrote: > >> *a = 9 # i like this number :) > > ... > >> a << 5 > >> b = *a # => [9,5] ------- an Array > >> here it seems false "*x equals [x] without the []" > > > > Actually, the "rule" still applies, in that: > > > > b = *a # where a = [9, 5] > > > > and > > > > b = 9, 5 > > > > Have the same effect. You were just forgetting to consider that b > > would just slurp them back into an array. > > > >> *a # => compile error > > > > This seems to be the only remaining "anomaly". > > It isn't, though: > > irb#1(main):017:0> a = [9,5] > => [9, 5] > irb#1(main):018:0> *a > SyntaxError: compile error > (irb#1):18: syntax error > from (irb#1):18 > irb#1(main):019:0> 9,5 > SyntaxError: compile error > (irb#1):19: syntax error > from (irb#1):19 > > > David > > -- > Q. What is THE Ruby book for Rails developers? > A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) > (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) > Q. Where can I get Ruby/Rails on-site training, consulting, coaching? > A. Ruby Power and Light, LLC (http://www.rubypal.com) > > -- sur http://expressica.com ------=_Part_59522_20351716.1171566292908--