From: Robert Dober Date: 2008-02-24T20:18:01+09:00 Subject: Re: ANN: Teach yourself Ruby - the hard way! On Sat, Feb 23, 2008 at 10:24 PM, Joel VanderWerf wrote: > > Robert Dober wrote: > > On Sat, Feb 23, 2008 at 10:44 AM, Martin DeMello > > wrote: > >> A frequent question from Ruby newcomers is "Okay, I've read the > >> tutorials - now what?". To that end, I'm putting together a series of > >> tutorials, each of which leads the student step by step through the > >> construction of a complete ruby program. There are no answers and no > >> explanations provided - rather, each question is followed by a hint > >> containing relevant topics to be looked up in the Pickaxe, on Google, > >> etc. > >> > >> The entry-level program is an arithmetic tutor; the reader is assumed > >> to have worked their way through Chris Pine's tutorial, and have a > >> copy of the docs handy. (Later programs will assume that the reader > >> has done the previous ones). Here's the first, tentative draft - > >> comments and suggestions welcomed. > >> > >> http://zem.novylen.net/ruby/tutorial/arithmetic-quiz/arith.html > >> > >> martin > >> > >> > > > > Nice work Martin, I suggest however that you do a > > gsub("function","method") on your text, there are just no functions in > > Ruby. > > What do you think? > > Cheers > > Robert > > > > $ grep function *.h > ruby.h:void rb_define_module_function _((VALUE,const > char*,VALUE(*)(ANYARGS),int)); > ruby.h:void rb_define_global_function _((const > char*,VALUE(*)(ANYARGS),int)); > > It looks like the functions in the tutorial are the global kind. > > Dunno if that term is deprecated and used only for historical reasons, > though. > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > Worse there is even module_function, I hate it. But I think that the community uses method almost exclusively. Strange that I never complained about #module_function, it made it even into 1.9 brrrr. Cheers Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein