Thinking Functionally In Ruby


What functional programming is ?
Why it's a "pretty neat idea" ?
How to adopt functional programming principles in Ruby ?

2 commenti:

belch ha detto...

Here you can find a video of the entire presentation.

belch ha detto...

One remark about presentation. Mixing zip and flatten, as author suggest:


>> a=(0..5).to_a
=> [0, 1, 2, 3, 4, 5]
>> b=(10..15).to_a
=> [10, 11, 12, 13, 14, 15]
>> a.zip(b).flatten
=> [0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15]

is not good as using + operator:

>> a=(0..5).to_a
=> [0, 1, 2, 3, 4, 5]
>> b=(10..15).to_a
=> [10, 11, 12, 13, 14, 15]
>> a + b
=> [0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]

Posta un commento