24 Mar 2004 Archit   » (Journeyer)

Ah the lovely #inject in ruby =D

So today I was just discussing on #ruby-lang about how Array#inject and Range#inject is a neat concept, but till haven't appreciated it since I didn't see much application of the concept for something useful.

However shortly afterwards I came up with some ultra-sweet

def factorial (x); (1..x).inject { |a, b| a*b }; end

I love Ruby (and #inject) =D

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!