/*
 * ExpStats lib/exprs.js
 * copyright (c) 2015 Susisu
 */

"use strict";

function endModule() {
    module.exports = Object.freeze({
        "exprs"  : exprs,
        "parser" : parser,
        "prelude": prelude,

        "execute": execute
    });
}

var exprs   = require("./exprs/exprs.js"),
    parser  = require("./exprs/parser.js"),
    prelude = require("./exprs/prelude.js");

function execute(input, name, src) {
    var expr  = parser.parse(name, src);
    var env   = Object.create(prelude);
    env["$"] = input;
    for (var i = 0; i < input.length; i++) {
        env["$" + i.toString()] = input[i];
    }
    var _expr = expr.init(env, []);
    return _expr.eval();
}

endModule();

@@ -432,17 +432,274 @@
 var expr
- 
+;%0A    if (src instanceof Array) %7B%0A        expr = new exprs.Vector(%0A            undefined,%0A            src.map(function (s, index) %7B%0A                return parser.parse(name + %22:%22 + index.toString(), s);%0A            %7D)%0A        );%0A    %7D%0A    else %7B%0A        expr
  = parse
@@ -718,16 +718,22 @@
 , src);%0A
+    %7D%0A
     var 
@@ -736,18 +736,16 @@
 var env 
-  
 = Object

Support array source