17 Feb '12, 9pm

Understand Ruby's inject method through Haskell's monoids.

February 17, 2012 Tagged: inject enumerable recursion monoid Comments (View) Derive #inject for a better understanding Let’s talk about Enumerable#inject . It’s special to me. In other cultures it’s called foldl , foldLeft , reduce , catamorphism , or bananas (PDF). We got our name from Smalltalk, which got it from, I dunno, a folk song ? Inject is an abstraction over structural recursion . For examples, imagine a list were defined like this: class EmptyList end class ConsList def initialize(first, rest) @first = first @rest = rest end end factorials = ConsList.new(1, ConsList.new(2, ConsList.new(6, ConsList.new(24, ConsList.new(120, EmptyList.new))))) Computing the length of the list is simple: class EmptyList def length 0 end end class ConsList def length 1 + @rest.length end end Computing the product of the list is simple, too: class EmptyList def product 1 end end clas...

Full article: http://robots.thoughtbot.com/post/17782192029/derive-inje...

Tweets

The Rhythm Method

robots.thoughtbot.com 17 Feb '12, 10pm

February 17, 2012 Tagged: Trajectory Comments (View) The Rhythm Method One of our goals for Trajectory is to provide a gui...

@roannattan @short_sort @withyouu_ I found 2 CC...

one.pa.gov.sg 19 Feb '12, 6am

GENERAL INFORMATION AND REFUND POLICY FOR CC COURSES 1. PLEASE PAY YOUR COURSE FEE IN FULL UPON REGISTRATION, OTHERWISE, C...

@roannattan @short_sort @withyouu_ I found 2 CCs with korean class at saturday. which one better??

@roannattan @short_sort @withyouu_ I found 2 CC...

one.pa.gov.sg 19 Feb '12, 6am

GENERAL INFORMATION AND REFUND POLICY FOR CC COURSES 1. PLEASE PAY YOUR COURSE FEE IN FULL UPON REGISTRATION, OTHERWISE, C...

Short shorts - TODAYonline

todayonline.com 17 Feb '12, 9pm

For those who can't decide whether to wear their sporty sneakers or trusty flip flops, why not take a look at Havaianas' T...

Google To Understand Entities

Google To Understand Entities

seroundtable.com 14 Feb '12, 2pm

A Mashable story has details from Google's head of search, Amit Singhal on where Google search is heading. Here are two ex...

2 Is Always Better Than 1

2 Is Always Better Than 1

tekkaus.com 24 Feb '12, 4pm

I still remember that more than 6 years ago I was a single and available bloke who was dumped by my first girlfriend a few...