Skip to content
Back to formatted view

Raw Message

Message-ID: <20050302121317.GA1498@jtkpc.cmp.uea.ac.uk>
Date: 2005-03-02T12:13:17Z
From: Jan T. Kim
Subject: return from nested function?
In-Reply-To: <6eb05719add6861cc72c25a41f432622@fhcrc.org>

On Tue, Mar 01, 2005 at 11:21:44PM -0800, Seth Falcon wrote:
> On Feb 25, 2005, at 12:34 PM, jhallman at frb.gov wrote:
> 
> >Is is possible from within a function to cause its caller to return()?
> 
> This snippet may be of interest:
> 
> 
> > f = function(x) {
> + print("f")
> + g(return())
> + print("end of f")
> + }
> 
> > g=function(x) {print("g")
> + x
> + print("end of g")
> + }
> 
> > f(1)
> [1] "f"
> [1] "g"
> NULL

I may be dumb today, but doesn't that beg the question of how does g
cause f not to return?

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email: jtk at cmp.uea.ac.uk                               |
 |    *NEW*    WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*