From: Stu Date: 2013-06-20T06:40:03+09:00 Subject: Re: getting the most out of Ruby --14dae93d9092e6a7ff04df88ab76 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jun 18, 2013 at 6:09 PM, robin wood wrote: Brandon W. wrote in post #1112804: > Blocks, Lambdas, Closures, Metaprogramming, and Enumerables are the huge > topics. Master them and you'll see a huge difference. Got any resources you used to help get your head around all these? I felt that the book "Meta-Programming Ruby" was very eye opening. It explains the object model in the first 100 pages. I recommend it based on what you've said. I rarely push books but that one seems to be written by someone who thought through the pedagogical approach of Ruby paradigm with everyone coming from different programming backgrounds. On Wed, Jun 19, 2013 at 3:45 AM, Robert Klemme wrote: > > > > On Wed, Jun 19, 2013 at 10:42 AM, Robert Klemme < > shortcutter@googlemail.com> wrote: > >> >> >> >> On Tue, Jun 18, 2013 at 9:59 PM, Brandon Weaver wrote: >> >>> The biggest jumping point for me is when I stopped trying to program >>> Ruby like C# and started programming Ruby like Ruby. >>> >> :-) >> >>> Coming from C land you have tendencies towards a lot of imperative >>> techniques, and Ruby is not solely imperative. Learning the functional side >>> of Ruby is essential to graduate into advanced topics. >>> >> I'd be careful labeling Ruby as "functional". The only "functional" >> about Ruby is that with lambda you can have anonymous functions which you >> can pass around. The core feature of funct >> > > > Sorry, somehow I hit the wrong button and GMail just sent off the email. > What I wanted to say: > > I'd be careful labeling Ruby as "functional". The only "functional" about > Ruby is that with lambda you can have anonymous functions which you can > pass around and create higher order functions. The core feature of > functional programming for me was always functions without side effects. > And that is not part of Ruby. Of course, you _can_ code lambdas without > side effects - but the language does not enforce this. > > Kind regards > > robert > > I agree with you. I am very careful with when I write statements like that hence I said "style" as in functional style. I am very used to That lambda is important though. It is essentially the primitive of functional programming( i.e. everything can be build from combination of lambdas) though it would be not very efficient and is something which may be explained from a pure "theoretical language" it's neat to know. Some people have ported base scheme implementations to ruby( as those guys port that language to everything) with just the lambda (once again neat but not really useful)... bus scheme I believe is one which is the main 7( or 9) original lisp primitives in 40 lines of code. Though from an analytical point of view it's refreshing when the language creator explains his motivations when creating ruby: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/179642 http://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life There are some others besides lambda and eval in recent ruby releases such as both callcc and curry. But lambda the ultimate for those who are into language creation. I recall a higher order cons enumerators. But it wasn't a pure cons (each_cons maybe). If we had cons we could create our own literals and further car/cdr would simply be aliases to first and *rest of the list which for the most part is basically an array with whitespace instead of commas for delimitation. ~Stu --14dae93d9092e6a7ff04df88ab76 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Tue, Jun 18, 2013 at 6:09 PM, robin wood <= span dir=3D"ltr"><lists@ruby-forum.com> wrote:
Brandon W. wrote in post = #1112804:
> Blocks, Lambdas, Closures, Metaprogramming, and Enum= erables are the huge
> topics. Master them and you'll see a huge difference.

Got any resources you used to help get your head around all these?
I felt that the book "Meta-Programming Ruby" was very e= ye opening. It explains the object model in the first 100 pages. I recommen= d it based on what you've said. I rarely push books but that one seems = to be written by someone who thought through the pedagogical approach of Ru= by paradigm with everyone coming from different programming backgrounds.


On Wed, = Jun 19, 2013 at 3:45 AM, Robert Klemme <shortcutter@googlemail.co= m> wrote:



On Wed, Jun 19, 2013 at 10:42 AM, Robert Klemme <shortcutter@goo= glemail.com> wrote:



On Tue, Jun 18, 2013 at 9:59 PM, Brandon Weaver <= keystonelemur@= gmail.com> wrote:

The biggest jumping point for me is when I stopped trying to program Ruby = like C# and started programming Ruby like Ruby.

:-)=A0

Coming from C land you have tendencies towards a lot of impe= rative techniques, and Ruby is not solely imperative. Learning the function= al side of Ruby is essential to graduate into advanced topics.

I'd be careful labeling Ruby as "functional". =A0T= he only "functional" about Ruby is that with lambda you can have = anonymous functions which you can pass around. =A0The core feature of funct=
=A0

Sorr= y, somehow I hit the wrong button and GMail just sent off the email. =A0Wha= t I wanted to say:

I'd be careful labeling= Ruby as "functional". =A0The only "functional" about R= uby is that with lambda you can have anonymous functions which you can pass= around and create higher order functions. =A0The core feature of functiona= l programming for me was always functions without side effects. =A0And that= is not part of Ruby. =A0Of course, you _can_ code lambdas without side eff= ects - but the language does not enforce this.

Kind regards

robert


I agree with you. I am very = careful with when I write statements like that hence I said "style&quo= t; as in functional style. I am very used to That lambda is important thoug= h. It is essentially the primitive of functional programming( i.e. everythi= ng can be build from combination of lambdas) though it would be not very ef= ficient and is something which may be explained from a pure "theoretic= al language" it's neat to know. Some people have ported base schem= e implementations to ruby( as those guys port that language to everything) = with just the lambda (once again neat but not really useful)... bus scheme = I believe is one which is the main 7( or 9) original lisp primitives in 40 = lines of code.

Though from an analytical point of view it's refreshing = when the language creator explains his motivations when creating ruby:
<= a href=3D"http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/17964= 2">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/179642
There are some others besides lambda and eval in= recent ruby releases such as both callcc and curry. But lambda the ultimat= e for those who are into language creation. I recall a higher order cons en= umerators. But it wasn't a pure cons (each_cons maybe). If we had cons = we could create our own literals and further car/cdr would simply be aliase= s to first and *rest of the list which for the most part is basically an ar= ray with whitespace instead of commas for delimitation.

~Stu

--14dae93d9092e6a7ff04df88ab76--