From: Kent Dahl Date: 2001-11-22T06:34:50+09:00 Subject: [ruby-talk:26076] Re: call_myself Ralph Mason wrote: > > While I don't agree that call_self is of use. Arg! You beat me to it, since I can't tell heads nor tails of RegExps ;-) But anyway, wouldn't your solution only handle single argument functions? *runs off, steals Ralph's code, adds 2 asterisk and chucks it in Kernel instead* module Kernel def call_myself( *a ) caller[-2] =~/(\w*)'/ send( $1, *a ) end end def fact(n) if n == 0 1 else n * call_myself(n-1) end end puts fact(5) .... now if only I understood your 2 liner regexp black magic ;-) -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.�k.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/