 
  
  
  
 
Maple supports nested procedures. For example, you can write
f1 := proc(x) local g; g := x -> x+1; x*g(x) end;
Procedure  has a local variable 
 which is a procedure.
 computes 
.  However, nested parameters and local variables
do not use nested scoping rules.  E.g. the above procedure is not
equivalent to this one
f2 := proc(x) local g; g := () -> x+1; x*g() end;
because the reference to  in the 
 procedure does not refer to
the parameter 
 in 
.  It refers to the global variable
.  Consider these examples
> f1(a);
                                   a (a + 1)
> f2(a);
                                   a (x + 1)
> x := 7;
                                     x := 7
> f2(a);
                                      8 a
One similarly cannot refer to local variables in outer scopes.