square.js Maximum call stack size exceeded

I am trying to use latin-square library for node.js in a loop to find some pattern, run the script and after 2 minutes have this error:

RangeError: Maximum call stack size exceeded

var latinSquare = require("latinsquare");
var lookup;
var loop;
lookup    =    ls();

console.log("first: "+ lookup);

/*---------------------------------------------------------------------------------------------------------------------------------*/
function find() {
    lookup    =    ls();
    console.log("loop: " + lookup);
    if(codeM(000000) == "1558" && codeM(111111) == "8691"){
        console.log("find: " + lookup);
        clearInterval(loop);
    }
}

loop =    setInterval(find,500);
/*---------------------------------------------------------------------------------------------------------------------------------*/
function ls(){
    var table = [];
    lookup = latinSquare.generate([0,1,2,3,4,5,6,7,8,9]);

    for(i=0;i<lookup.length;i++){
        for(d=0;d<lookup[i].length;d++){
            table.push(lookup[i][d]);
        }
    }
    return    table;
}
/*---------------------------------------------------------------------------------------------------------------------------------*/
function codeM(data){
    // this function return a result of mathematic procces. not call another function.
}

function padLeft(nr, n, str){
    return Array(n-String(nr).length+1).join(str||'0')+nr;
}

Well ... to look for a pattern in a mathematical function, I need this code below to work infinitely. I am a beginner in javascript and I do not know how to solve it

var latinSquare = require("latinsquare");

var count =0;

setInterval(function(){

var table =[];

var search  =   latinSquare.generate([0,1,2,3,4,5,6,7,8,9]);

for(i=0;i<search.length;i++){

    for(d=0;d<search[i].length;d++){

        table.push(search[i][d]);

    }
}

count++;

console.log(count + "...... " + table);

},100);

链接地址: http://www.djcxy.com/p/80244.html

上一篇: 在linux中的程序内存布局

下一篇: square.js超出最大调用堆栈大小