PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > ANN: Teach yourself Ruby - the hard way!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
ANN: Teach yourself Ruby - the hard way!

Réponse
 
LinkBack Outils de la discussion
Vieux 23/02/2008, 09h44   #1
Martin DeMello
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ANN: Teach yourself Ruby - the hard way!

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...uiz/arith.html

martin

  Réponse avec citation
Vieux 23/02/2008, 09h56   #2
Michael Fellinger
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 6:44 PM, Martin DeMello <martindemello@gmail.com> 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...uiz/arith.html


Good work, but may i point out that 'if' is no method?

^ manveru

  Réponse avec citation
Vieux 23/02/2008, 10h07   #3
Martin DeMello
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 1:56 AM, Michael Fellinger
<m.fellinger@gmail.com> wrote:

> > http://zem.novylen.net/ruby/tutorial...uiz/arith.html

>
> Good work, but may i point out that 'if' is no method?


Yeah, right now I'm using # as a placeholder for a css class that will
cover both methods and keywords - basically, things to look up
directly in the documentation/pickaxe index, rather than more general
concepts to google for.

martin

  Réponse avec citation
Vieux 23/02/2008, 10h35   #4
Vitillo Roberto
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

Nice work, Martin
  Réponse avec citation
Vieux 23/02/2008, 11h44   #5
Robert Dober
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 10:44 AM, Martin DeMello
<martindemello@gmail.com> 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...uiz/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

--
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein

  Réponse avec citation
Vieux 23/02/2008, 12h36   #6
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

Thanks for putting in the time and effort for that Martin.
I am very much a new to Ruby and found that Chris uses version 1.8.2
version of Ruby which has given me a few problems as the instructions
in Chris`s book don`t correspond to the latest (186.25?) version I
have and it seems 1.8.2 is not now available. Guys on the forum have
been very ful with their suggestions but I was a bit concerned at
failing at the very first prog I started ;-(.
I shall persevere. I`ll have to do now I`ve just enrolled on the
online Ruby course run by Satish.
Cheers
Steve
  Réponse avec citation
Vieux 23/02/2008, 20h59   #7
Martin DeMello
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 3:44 AM, Robert Dober <robert.dober@gmail.com> wrote:
>
> 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?


I did think about that, and deliberately decided to go with
'function', since from a newbie perspective toplevel methods *are*
functions.

Pros: Clear, conceptually simple to understand, a useful and
for-the-moment accurate model of what's happening
Cons: Technically incorrect, but to explain the difference would delve
into ruby's object model a bit too soon.

martin

  Réponse avec citation
Vieux 23/02/2008, 21h24   #8
Joel VanderWerf
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

Robert Dober wrote:
> On Sat, Feb 23, 2008 at 10:44 AM, Martin DeMello
> <martindemello@gmail.com> 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...uiz/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

  Réponse avec citation
Vieux 24/02/2008, 11h11   #9
Robert Dober
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 9:59 PM, Martin DeMello <martindemello@gmail.com> wrote:
> On Sat, Feb 23, 2008 at 3:44 AM, Robert Dober <robert.dober@gmail.com> wrote:
> >
> > 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?

>
> I did think about that, and deliberately decided to go with
> 'function', since from a newbie perspective toplevel methods *are*
> functions.
>
> Pros: Clear, conceptually simple to understand, a useful and
> for-the-moment accurate model of what's happening
> Cons: Technically incorrect, but to explain the difference would delve
> into ruby's object model a bit too soon.
>
> martin
>
>

Ok I see, I thought it was more an oversight, sorry for wasting your time
R.



--
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein

  Réponse avec citation
Vieux 24/02/2008, 11h18   #10
Robert Dober
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sat, Feb 23, 2008 at 10:24 PM, Joel VanderWerf
<vjoel@path.berkeley.edu> wrote:
>
> Robert Dober wrote:
> > On Sat, Feb 23, 2008 at 10:44 AM, Martin DeMello
> > <martindemello@gmail.com> 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...uiz/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

  Réponse avec citation
Vieux 27/02/2008, 05h38   #11
Chad Perrin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Sun, Feb 24, 2008 at 05:59:46AM +0900, Martin DeMello wrote:
> On Sat, Feb 23, 2008 at 3:44 AM, Robert Dober <robert.dober@gmail.com> wrote:
> >
> > 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?

>
> I did think about that, and deliberately decided to go with
> 'function', since from a newbie perspective toplevel methods *are*
> functions.
>
> Pros: Clear, conceptually simple to understand, a useful and
> for-the-moment accurate model of what's happening
> Cons: Technically incorrect, but to explain the difference would delve
> into ruby's object model a bit too soon.


There's a middle road: Mention briefly that they're called "methods",
even if they fill the same role as "functions" in many other languages,
and leave it at that.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
W. Somerset Maugham: "The ability to quote is a serviceable substitute for
wit."

  Réponse avec citation
Vieux 27/02/2008, 05h48   #12
Martin DeMello
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ANN: Teach yourself Ruby - the hard way!

On Tue, Feb 26, 2008 at 9:38 PM, Chad Perrin <perrin@apotheon.com> wrote:
>
> There's a middle road: Mention briefly that they're called "methods",
> even if they fill the same role as "functions" in many other languages,
> and leave it at that.


Good point. I'll make the change.

martin

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20060 seconds with 20 queries