From: Dave Burt Date: 2005-10-06T00:36:49+09:00 Subject: Re: [Quiz] [Solution] Lisp Game Brian Schr�der: > ... > or even > > splash bottle frog > > to work. > > Then I rewrote the whole thing in ruby style using a readline > interface and adding some capabilities. I think it came out quite nice > and I juggled a lot with meta programming concepts. So thanks to all > the helpfull people here on the list I have learned a lot this week. I've enjoyed reading both versions of your code. It looks a lot more comfortable than my attempts at retaining the LISP code's semantics. The define_game_action method is particularly interesting: using "subject, object = *args.flatten" to un-collect arguments from a passed array (built by a magic method-missing) is cool. The coolest bit, though, is passing the parameter (local) variable action to instance_eval inside the define_method block. I don't quite get how that works; if you read my code, you'll see I defined that function into a separate method. I thought methods were banned from accessing local variables from outside their scope - this one seems to be staying in like in a closure. I'm glad to see evidence in the "Eval and block problems" thread that it's harder than it looks for other people, too :) Cheers, Dave