You may have already spotted this, but just in case not: the expression :(x 
-> y=1; y+x+z) will eval to a declaration of the anonymous function x -> 
y=1 and an attempt to add x, y and z. You should write :( x -> (y=1; y+x+z) 
) if you intend both of the latter expressions to be a part of the 
anonymous function's body.

On Friday, May 8, 2015 at 2:41:00 PM UTC-4, Jonathan Malmaud wrote:
>
> Say I have a quoted anonymous function, like :(x->y=1; y+x+z). I'd like to 
> determine that 'z' is not bound within the function (ie, is a reference to 
> an enclosing outer/global scope). What's a good way to do it? 
>
> I know I could recursively analyze the Expr, keeping track of which 
> variables were assigned to at each scope level introduced within the Expr, 
>  but that seems like I'd be duplicating effort that must implicitly be in 
> Julia already and might be brittle with regard to subtle scoping rules. 
>

Reply via email to