From: Kero Date: 2006-02-19T07:48:29+09:00 Subject: Re: [QUIZ] metakoans.rb (#67) >> I also have 13; however, two lines exceed 80 columns. Additionally, I >> have no support for multiple attributes on one line -- seems logical >> to have... > > 13 seems to be the lower limit without seriously golfing. My "best" > solution at this point runs about 18 lines, but it'd be 13 if I took out > all the blank lines and one line that makes it faster but doesn't affect > the semantics. Dunno about golfing, been snowboarding the whole week. I'm near koan 8 with 28 lines, and I need sleep (failed at 7, while wondering why the program knew I did [need sleep]; Then I solved 7 while puzzling about 8, or actually ironing out an inconsistency in my program; maybe I am already asleep) Anyway, what I wanted to post about: in the description/code there are a few asserts like this: assert{ (o.a = nil) == nil } which will always be asserted, since Ruby evaluates 'a = b' to b, no matter what a is; specifically, it does not evaluate to the result of #a= in code like 'o.a = b'; imho, this makes perfect sense for statements like 'a = b = c' Code to show: class X attr_reader :ha def ha=(val) @ha = "not what you expect" end end x = X.new p x.ha = nil # => nil p x.ha # => "not what you expect" p (x.ha = nil) == nil # => true Bye, Kero. PS: fun quiz!