On Jun 17, 2008, at 9:46 PM, Chance Dinkins wrote:

> Thanks guys, I apperciate it - these.. dynamic methods (is that what
> they are considered?) are a little strange to me.

they are normal functions but one's which take anonymous functions  
(blocks) as arguments.  ruby makes this very easy on the eyes, but  
even C has this concept: do a 'man qsort' and you'll see

      void
      qsort(void *base, size_t nel, size_t width, int (*compar)(const  
void *, const void *));

note the 'compar' function you can pass in.  so, in c, you have to  
define that function up front and then pass a pointer to it.  in ruby  
you can do things like

   compar = lambda{|a,b| a <=> b}

   array.qsort &compar

or, more compactly

   array.qsort{|a,b| a <=> b}

of course the method is called 'sort' and not 'qsort', but the  
principle is exactly the same.


kind regards.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama