From: Henning von Rosen Date: 2001-12-23T20:11:10+09:00 Subject: [ruby-talk:29353] Re: a better way? > I was writing a little code that cached a function value, and wound up > with this: > > result = @@save[self] > return result if result > I don't see a way to do it in one line unless I'm willing to do the > lookup twice. Am I missing something? @@save.fetch(self){your funcdef} you coluld also use "fetch" /h > Thanks! > > Ronald E Jeffries > http://www.XProgramming.com > http://www.objectmentor.com