xgod
2014-04-19 19:15:02 +08:00
function BIGen (token) {
var BIContent = R['/']([token, R['s']([Char, BIContent])]);
return R['s']([token, Char, BIContent]);
}
function series (first, second) {
return function (input, index) {
var result = first(input, index);
if (result) return result;
result = second(input, index);
return {output: result.output, index: result.index};
}
}
------------
真心不明白你想描述的问题是什么。你想返回一个闭包,然后在闭包函数里面引用闭包函数本身?
是这意思?
function series (first, second) {
var noname= function (input, index) {
var result = first(input, index);
if (result) return result;
result = noname(input, index);
return {output: result.output, index: result.index};
}
return noname;
}