public override Expression GenerateRead(Compilation.AstGenerator gen)
 {
     return gen.Function(
         name,
         parameters.Select(p =>
             new KeyValuePair<string, Expression>(p.Name, p.DefaultValue == null ? null : p.DefaultValue.GenerateRead(gen))
         ),
         () => body.Select(
             e => e.Generate(gen)
         ).SelectMany(e => e),
         scope.Variables
     );
 }
 public override IEnumerable<Expression> Generate(Compilation.AstGenerator gen)
 {
     return new Expression[] { gen.Scope.ResolveWrite(
         gen, 
         name, 
         gen.Function(
             name,
             parameters.Select(p =>
                 new KeyValuePair<string, Expression>(p.Name, p.DefaultValue == null ? null : p.DefaultValue.GenerateRead(gen))
             ),
             () => body.Select(e =>
                 e.Generate(gen)
             ).SelectMany(e => e),
             scope.Variables
         )
     ) };
 }