Skip to content
Snippets Groups Projects
graph2D.component.ts 64.4 KiB
Newer Older
    var nameFun = [];
    nameFun.push(fun1.fun);
    funciones = this.armarFuncion(fun1.bdy,graph,nameFun);

    for (var funs of funciones){
        for (var fun of graph.funs){
            if (fun.fun != fun1.fun){
                funcionString = 'var ' + fun.fun + ' = function(' + fun.args.join() + '){\n return ' + this.generarExpresion(fun.bdy) + '}\n' + funcionString;
            }
        }
        funcionString = 'var ' + fun1.fun + ' = function(' + fun1.args.join() + '){\n return ' + funs + '}\n' + funcionString;

        funcionString += ';return ' + fun1.fun + '(' + fun1.args.join() + ');\n'
        grafica = fun1;
        funcionString = '(' + grafica.args.join() + ')=>{\n' + funcionString + '}';
        arrayFunction.push(funcionString);   
        var funcionString = '';
    }
    console.log(arrayFunction[0])
    return arrayFunction;
}

armarFuncion = function (exp,graph,nameFun){
    var lisArm = this.generateFunctionAndExp(exp,graph,nameFun);
    var lisFun = [];
    for(var lis of lisArm){
        var aux = '';
        if(lis[0] == 'N'){
            aux = lis[1];
        }else{
            aux = '('+lis[0]+' ? '+lis[1]+' : undefined )';
        }
        lisFun.push(aux);
    }
    return lisFun
}


generateFunctionAndExp = function (exp,graph,namefun6) {
    var myList = [];
    // devuelvo lista con tupla (cond,funcion)
    if (exp.kind == 'cnd') {
        var lisA = this.generateFunctionAndExp(exp.exp1,graph,namefun6);
        var lisB = this.generateFunctionAndExp(exp.exp2,graph,namefun6);
        var cond = this.createListExp(exp.cond);
        var g = this.createListExp(exp.cond);
        var aux121 = [];
        var cond2 = g.splice(1);
        var union = g[0]


        for(var a of cond2){
            union = '('+union+' && '+a+')';
        }
        for (var fun1 of lisA){
            if(fun1[0] == 'N'){
                if(cond.length == 0){
                    aux121[0]='N';
                }else{
                    aux121[0]=union;
                }
            }else{ 
                aux121[0]= '('+fun1[0]+' && '+union+ ')';
            }
            aux121[1] = fun1[1];
            myList.push(aux121);
        }
        for (var fun2 of lisB){
            if(cond.length != 0){
                for (var condi of cond){
                    var aux123 = [];
                    aux123[1]=fun2[1];
                    if(fun2[0] == 'N'){
                            aux123[0]='!('+condi+')';
                    }else{
                        aux123[0] = '('+fun2[0]+' && !('+condi+'))';
                    }
                    myList.push(aux123);
                }
            }else{
                myList.push(fun2);
            }
        }
        
    } else if (exp.kind == 'bop') {
        
        if (exp.op == '^') {
            var lisA1 = this.generateFunctionAndExp(exp.exp1,graph,namefun6);
            var lisB1 = this.generateFunctionAndExp(exp.exp2,graph,namefun6);
            var aux1 = [];
            for (var f1 of lisA1){
                for (var f2 of lisB1){
                    var aux11 = 'Math.pow('+f1[1]+' , '+f2[1]+')';
                    var aux21;
                    if ((f2[0] == 'N') && (f1[0] == 'N')){
                        aux21 = 'N'
                    }else if(f2[0] == 'N'){
                        aux21=f1[0]
                    }else if(f1[0] == 'N'){
                        aux21=f2[0]
                    }else{
                        aux21= '('+f1[0]+' && '+f2[0]+')';
                    }
                    aux1[0]= aux21;
                    aux1[1] = aux11;
                    myList.push(aux1);
                }
            }
        } else {

            var lisA2 = this.generateFunctionAndExp(exp.exp1,graph,namefun6);
            var lisB2 = this.generateFunctionAndExp(exp.exp2,graph,namefun6);
            var aux2 = [];
            for (var f1 of lisA2){
                for (var f2 of lisB2){
                    var aux12 = '(('+f1[1]+')'+exp.op+'('+f2[1]+'))';
                    var aux22
                    if ((f2[0] == 'N') && (f1[0] == 'N')){
                        aux22 = 'N'
                    }else if (f2[0] == 'N'){
                        aux22 =f1[0]
                    }else if (f1[0] == 'N'){
                        aux22 =f2[0]
                    }else{ 
                        aux22= '('+f1[0]+' && '+f2[0]+')';
                    }
                    aux2[0]= aux22;
                    aux2[1] = aux12;
                    myList.push(aux2);

                }
            }
        }
    } else if (exp.kind == 'uop') {
        var lisA3 = this.generateFunctionAndExp(exp.exp,graph,namefun6);
        var aux3 = [];
        for (var f1 of lisA3){
                var aux13 = ' '+exp.op+' '+f1[1]+' ';               
                aux3[0]= f1[0];
                aux3[1] = aux13;
                myList.push(aux3);   
        }
    } else if (exp.kind == 'app') {       
        if ((exp.fun == 'Math.cos') || (exp.fun == 'cos')) {
            var aux4 = [];
            var aux14 = 'Math.cos('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux24 = 'N'
            aux4[0]= aux24;
            aux4[1] = aux14;
            myList.push(aux4);           
        } else if ((exp.fun == 'Math.sin') || (exp.fun == 'sin')) {
            var aux5 = [];
            var aux15 = 'Math.sin('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux25 = 'N'
            aux5[0]= aux25;
            aux5[1] = aux15;
            myList.push(aux5);
        } else if ((exp.fun == 'Math.round') || (exp.fun == 'round')){
            var aux6 = [];
            var aux16 = 'Math.round('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux26 = 'N'
            aux6[0]= aux26;
            aux6[1] = aux16;
            myList.push(aux6);
leonelrosano's avatar
leonelrosano committed
        }else if ((exp.fun == 'Math.sqrt') || (exp.fun == 'sqrt')){
            var aux7 = [];
            var aux17 = 'Math.sqrt('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux27 = 'N'
            aux7[0]= aux27;
            aux7[1] = aux17;
            myList.push(aux7);
        
        }else if (exp.args[0].kind == 'app'){
            var aux101 = [];
            var aux1101 = exp.fun+'('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux2101 = 'N'
            aux101[0]= aux2101;
            aux101[1] = aux1101;
            myList.push(aux101);
        

        }else if(((exp.args[0].kind == 'cnd' || exp.args[0].kind == 'bop') && (exp.args[0].exp1.kind == 'app' || exp.args[0].exp2.kind == 'app' )) || (exp.args[0].kind == 'uop' && exp.args[0].exp.kind == 'app') ){
            var aux102 = [];
            var aux1102 = exp.fun+'('+ exp.args.map(e => this.generarExpresion(e)).join() +')';
            var aux2102 = 'N'
            aux102[0]= aux2102;
            aux102[1] = aux1102;
            myList.push(aux102);
        }else{ 

            if(!namefun6.includes(exp.fun)){
                var ListnameFNew = namefun6;
                ListnameFNew.push(exp.fun);
                for (var fun5 of graph.funs){
                    if(fun5.fun == exp.fun){
                        fun5.bdy.args = exp.args;
                         myList = this.generateFunctionAndExp(fun5.bdy,graph,ListnameFNew);
                    }
                }
            }else{
                var aux76 = [];
                aux76[0] = 'N';
                aux76[1] = exp.fun + "("+exp.args.map(e => this.generarExpresion(e)).join()+")";
                myList.push(aux76);
            }
        }
        
    } else if (exp.kind == 'tup') {
        var lisA7 = this.generateFunctionAndExp(exp.exps,graph,namefun6);
        for (var f of lisA7){
            var aux65 = [];
            aux65[1] = '('+f[1]+')';
            aux65[0] = f[0];
            myList.push(aux65);
        }
       //Es esto o las combinaciones
       // expresion = ' (' + exp.exps.map(e => this.generarExpresion(e)).join() + ') ';
    } else if (exp.kind == 'lit') {
        var aux8 = [];
        aux8[0] = 'N';
        aux8[1] = ' ' + exp.val + ' ';
        myList.push(aux8);
    } else if (exp.kind == 'var') {

        var aux9 = [];
        aux9[0] = 'N';
        aux9[1] = ' ' + exp.var + ' ';
        myList.push(aux9);
    } else {
        var aux54 = [];
        aux54[0]= 'N';
        aux54[1]='undefined';
        myList.push(aux54);
    }

    return myList;
}

/////////////////////

createListExp = function (exp) {
    var expresion = '';
    var funcione = [];
    if (exp.kind == 'cnd') {
            funcione = this.createListExp(exp.cond);
    } else if (exp.kind == 'bop') {
        if (exp.op == '==') {
            expresion = ' Math.abs((' + this.createListExp(exp.exp1)[0] + ') - (' + this.createListExp(exp.exp2)[0] + ')) == 0 ';
            if(exp.exp1.kind == 'lit'){
                this.valores.push(exp.exp1.val)
            }
            if(exp.exp2.kind == 'lit'){
                this.valores.push(exp.exp2.val)
            }
            funcione.push(expresion)

        } else if (exp.op == '/=') {
            expresion = ' Math.abs((' + this.createListExp(exp.exp1) + ') - (' + this.createListExp(exp.exp2) + ')) != 0';
            funcione.push(expresion)

        } else if (exp.op == '^') {
            expresion = ' Math.pow(' + this.createListExp(exp.exp1) + ',' + this.createListExp(exp.exp2) + ') ';
            funcione.push(expresion)

        } else if (exp.op == '&&'){
            
            for (var atr of this.createListExp(exp.exp1)){
                funcione.push(atr)
            }
            for (var atr2 of this.createListExp(exp.exp2)){
                funcione.push(atr2)
            }
        }else if (exp.op == 'or'){
            funcione.push('!'+this.createListExp(exp.exp1))
            funcione.push('!'+this.createListExp(exp.exp2))
        }else{
            var lis1 = this.createListExp(exp.exp1)
            var lis2 = this.createListExp(exp.exp2)
            for(var expes1 of lis1){
                for (var expes2 of lis2){
                    expresion = ' ((' + expes1 + ')' + exp.op + '(' + expes2 + ') )';
                    funcione.push(expresion)
                }
            }
        }
    } else if (exp.kind == 'uop') {
        expresion = ' ' + exp.op + ' ' + this.createListExp(exp.exp) + ' ';
        funcione.push(expresion)

    } else if (exp.kind == 'app') {

        if (exp.fun == 'Math.cos') {
            exp.fun = 'Math.cos'
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresion(e)).join() + ') ';
            funcione.push(expresion)

        } else if (exp.fun == 'Math.sin') {
            exp.fun = 'Math.sin'
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresion(e)).join() + ') ';
            funcione.push(expresion)

        } else if (exp.fun == 'Math.round') {
            exp.fun = 'Math.round'
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresion(e)).join() + ') ';
            funcione.push(expresion)

leonelrosano's avatar
leonelrosano committed
        } else if (exp.fun == 'Math.sqrt') {
            exp.fun = 'Math.sqrt'
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresion(e)).join() + ') ';
            funcione.push(expresion)

        }else{
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresion(e)).join() + ') ';
            funcione.push(expresion)
        }

    } else if (exp.kind == 'tup') {
        expresion = ' (' + exp.exps.map(e => this.generarExpresion(e)).join() + ') ';
        funcione.push(expresion)

    } else if (exp.kind == 'lit') {
        expresion = ' ' + exp.val + ' ';
        this.valores.push(exp.val)
        funcione.push(expresion)

    } else if (exp.kind == 'var') {

        expresion = ' ' + exp.var + ' ';
        funcione.push(expresion)

    } else {
        expresion = 'undefined ';
        funcione.push(expresion)

    }
    return funcione;
}
///////////////////// fin de nuevo


     // Prueba 2019
     generarFuncionDisc = function (graph) {
        var funcionString = '';
        var grafica;
        var arrayFunction = [];
        var fun = graph.funs[0];
        var ListnameF = [];
        ListnameF.push(fun.fun);
        var funciones = this.generarExpresionDisc(fun.bdy,graph,ListnameF)
        for (var funs of funciones){
            funcionString = 'var ' + fun.fun + ' = function(' + fun.args.join() + '){\n return ' + funs + '}\n' + funcionString;

            if (fun.fun == graph.graph) {
                funcionString += ';return ' + fun.fun + '(' + fun.args.join() + ');\n'
                grafica = fun;
            }
            funcionString = '(' + grafica.args.join() + ')=>{\n' + funcionString + '}';
            arrayFunction.push(funcionString);
            var funcionString = '';
        }


        var arrayFunction1 = [arrayFunction[0]]
        return arrayFunction;
    }

    generarExpresionDisc = function (exp,grap,ListnameF) {
        var expresion = '';
        var funcione = [];
        if (exp.kind == 'cnd') {

                var con1 = this.generarExpresionDisc(exp.cond,grap,ListnameF);
                var con11 = '';
                
                for (var condi of con1){
                    if (con11 == ''){
                        con11 = condi;
                    }else{
                        con11 = '('+con11 +' && '+ condi +')';
                    }
                    
                }
                for (var funs of this.generarExpresionDisc(exp.exp1,grap,ListnameF)){ 
                    funcione.push('('+con11+' ? '+ funs +' : undefined)');      
                }
                for (var funs2 of this.generarExpresionDisc(exp.exp2,grap,ListnameF)){ 
                    for (var condi2 of con1){
                        funcione.push('(!('+condi2+') ? '+ funs2 +' : undefined)');

                    }   
                }
            
            
           
        } else if (exp.kind == 'bop') {
            if (exp.op == '==') {
                expresion = ' Math.abs((' + this.generarExpresionDisc(exp.exp1,grap,ListnameF) + ') - (' + this.generarExpresionDisc(exp.exp2,grap,ListnameF) + ')) == 0 ';
                if(exp.exp1.kind == 'lit'){
                    this.valores.push(exp.exp1.val)
                }
                if(exp.exp2.kind == 'lit'){
                    this.valores.push(exp.exp2.val)
                }
                funcione.push(expresion)

            } else if (exp.op == '/=') {
                expresion = ' Math.abs((' + this.generarExpresionDisc(exp.exp1,grap,ListnameF) + ') - (' + this.generarExpresionDisc(exp.exp2,grap,ListnameF) + ')) != 0';
                funcione.push(expresion)

            } else if (exp.op == '^') {
                expresion = ' Math.pow(' + this.generarExpresionDisc(exp.exp1,grap,ListnameF) + ',' + this.generarExpresionDisc(exp.exp2,grap,ListnameF) + ') ';
                funcione.push(expresion)

            } else if (exp.op == '&&'){
                
                for (var atr of this.generarExpresionDisc(exp.exp1,grap,ListnameF)){
                    funcione.push(atr)
                }
                for (var atr2 of this.generarExpresionDisc(exp.exp2,grap,ListnameF)){
                    funcione.push(atr2)
                }
            }else if (exp.op == 'or'){
                funcione.push('!'+this.generarExpresionDisc(exp.exp1,grap,ListnameF))
                funcione.push('!'+this.generarExpresionDisc(exp.exp2,grap,ListnameF))
            }else{
                var lis1 = this.generarExpresionDisc(exp.exp1,grap,ListnameF)
                var lis2 = this.generarExpresionDisc(exp.exp2,grap,ListnameF)
                for(var expes1 of lis1){
                    for (var expes2 of lis2){
                        expresion = ' ((' + expes1 + ')' + exp.op + '(' + expes2 + ') )';
                        funcione.push(expresion)
                    }
                }


            }
        } else if (exp.kind == 'uop') {
            expresion = ' ' + exp.op + ' ' + this.generarExpresionDisc(exp.exp,grap,ListnameF) + ' ';
            funcione.push(expresion)

        } else if (exp.kind == 'app') {

			if (exp.fun == 'Math.cos') {
                exp.fun = 'Math.cos'
                expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresionDisc(e,grap,ListnameF)).join() + ') ';
                funcione.push(expresion)

			} else if (exp.fun == 'Math.sin') {
                exp.fun = 'Math.sin'
                expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresionDisc(e,grap,ListnameF)).join() + ') ';
                funcione.push(expresion)

			} else if (exp.fun == 'Math.round') {
                exp.fun = 'Math.round'
                expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresionDisc(e,grap,ListnameF)).join() + ') ';
                funcione.push(expresion)

leonelrosano's avatar
leonelrosano committed
            } else if (exp.fun == 'Math.sqrt') {
                exp.fun = 'Math.sqrt'
                expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarExpresionDisc(e,grap,ListnameF)).join() + ') ';
                funcione.push(expresion)
    
            }else{

                if(!ListnameF.includes(exp.fun)){

                    var ListnameFNew = ListnameF;
                    ListnameFNew.push(exp.fun);
                    for (var fun5 of grap.funs){

                        if(fun5.fun == exp.fun){

                            var funresul = this.generarExpresionDisc(fun5.bdy,grap,ListnameFNew);
                            for (var subfunciones of funresul){
                                funcione.push(subfunciones);
                            }
                            
                        }
                    }
                }else{
                    funcione.push(exp.fun);
                }
                
            }

        } else if (exp.kind == 'tup') {
            expresion = ' (' + exp.exps.map(e => this.generarExpresionDisc(e,grap,ListnameF)).join() + ') ';
            funcione.push(expresion)

        } else if (exp.kind == 'lit') {
            expresion = ' ' + exp.val + ' ';
            this.valores.push(exp.val)
            funcione.push(expresion)

        } else if (exp.kind == 'var') {

            expresion = ' ' + exp.var + ' ';
            funcione.push(expresion)

        } else {
            expresion = ' undefined ';
            funcione.push(expresion)

        }
        return funcione;
    }


     //Prueba 2019 fin






    //Nuevo 20-07-2018
    

    obtenerConjunto = function (grf) {
        var dominio = '{\"conj\": {';
        if (grf.dom == 'R') {
            dominio += "\"radio\": 0.3, \"baseDom\": \"R\", \"dom\": \"R\"";
            setf += "\"fdom\": \"R\",";
        } else if (grf.dom == 'Z') {
            dominio += "\"radio\": 2, \"baseDom\": \"Z\", \"dom\": \"Z\"";
            setf += "\"fdom\": \"Z\",";
        }/* else if (grf.dom == 'N') {
            dominio += "\"radio\":2, \"baseDom\": \"N\", \"dom\": \"N\"";
            setf += "\"fdom\": \"N\",";
            if (Array.isArray(grf.sets[0][nom])) {
                var arreglo = grf.sets[0][nom];
                var arreglo2 = [];
                for (var item of arreglo) {
                    arreglo2.push("\"" + item + "\"");
                }
                dominio += "\"radio\":2, \"baseDom\": \"N\", \"dom\": \"Numer\"";
                setf += "\"fdom\": [" + arreglo2 + "], ";
            } else {

                dominio += this.recursivoDom(grf.sets, nom);
                setf += "\"fdom\":\"function(x)\",";
        dominio += ", ";
        if (grf.cod == 'R') {
            dominio += "\"baseCod\": \"R\", \"cod\": \"R\" ,";
            setf += "\"fcod\": \"R\"";
        } else if (grf.cod == 'Z') {
            dominio += "\"baseCod\": \"Z\", \"cod\": \"Z\" ,";
            setf += "\"fcod\": \"Z\"";
        } else if (grf.cod == 'N') {
            dominio += "\"baseCod\": \"N\", \"cod\": \"N\" ,";
            setf += "\"fcod\": \"N\"";
        } else {
            if (Array.isArray(grf.sets[0][nom])) {
                var arreglo = grf.sets[0][nom];
                var arreglo2 = [];
                for (var item of arreglo) {
                    arreglo2.push("\"" + item + "\"");
                }
                dominio += "\"baseCod\": \"N\", \"cod\": \"Numer\" ,";
                setf += '\"fcod\":[' + arreglo2 + ']';
            } else {
                dominio += this.recursivoCod(grf.sets, nom);
                setf += "\"fcod\": \"function(x)\"";
    recursionfuncion = function (func, nombre) {
        var fun = func[0][nombre].set;
        var resul = "";
        if (fun == 'R' || fun == 'Z' || fun == 'N') {
            resul += this.generarF(func[0][nombre].cond);
        } else {
            resul += this.generarF(func[0][nombre].cond) + " && " + this.recursionfuncion(func, fun);

    recursivoDom = function (sets, nom) {
        if (sets[0][nom].set == 'R') {
            domin += "\"radio\": 0.3, \"baseDom\": \"R\", \"dom\": \"Func\"";
        } else if (sets[0][nom].set == 'Z') {
            domin += "\"radio\": 2, \"baseDom\": \"Z\", \"dom\": \"Func\"";
        } else if (sets[0][nom].set == 'N') {
            domin += "\"radio\": 2, \"baseDom\": \"N\", \"dom\": \"Func\"";
        } else {
            domin = this.recursivoDom(sets, nombre);

    recursivoCod = function (sets, nom) {
        if (sets[0][nom].set == 'R') {
            coodo += "\"baseCod\": \"R\", \"cod\": \"Func\",";
        } else if (sets[0][nom].set == 'Z') {
            coodo += "\"baseCod\": \"Z\", \"cod\": \"Func\",";
        } else if (sets[0][nom].set == 'N') {
            coodo += "\"baseCod\": \"N\", \"cod\": \"Func\",";
        } else {
            coodo += this.recursivoDom(sets, nombre);

    generarF = function (exp) {
        var expresion = '';
        if (exp.kind == 'cond') {
            expresion = ' (' + this.generarF(exp.cond) + '?' + this.generarF(exp.exp1) + ':' + this.generarF(exp.exp2) + ') ';
        } else if (exp.kind == 'bop') {
            if (exp.op == '==') {
                expresion = ' Math.abs((' + this.generarF(exp.exp1) + ') - (' + this.generarF(exp.exp2) + ')) == 0 ';
            } else if (exp.op == '/=') {
                expresion = ' Math.abs((' + this.generarF(exp.exp1) + ') - (' + this.generarF(exp.exp2) + ')) != 0 ';
            } else if (exp.op == '^') {
                expresion = ' Math.pow(' + this.generarF(exp.exp1) + ',' + this.generarF(exp.exp2) + ') ';
            } else {
                expresion = ' (' + this.generarF(exp.exp1) + ')' + exp.op + '(' + this.generarF(exp.exp2) + ') ';
            }
        } else if (exp.kind == 'uop') {
            expresion = ' ' + exp.op + ' ' + this.generarF(exp.exp) + ' ';
        } else if (exp.kind == 'app') {
            if (exp.fun == 'cos') {
                exp.fun = 'Math.cos'
                exp.fun = 'Math.sin'
            } else if (exp.fun == 'round') {
                exp.fun = 'Math.round'
leonelrosano's avatar
leonelrosano committed
            }else if (exp.fun == 'sqrt'){
                exp.fun = 'Math.sqrt'
            }
            expresion = ' ' + exp.fun + '(' + exp.args.map(e => this.generarF(e)).join() + ') ';
        } else if (exp.kind == 'tup') {
            expresion = ' (' + exp.exps.map(e => this.generarF(e)).join() + ') ';
        } else if (exp.kind == 'lit') {
            expresion = ' ' + exp.val + ' ';
        } else if (exp.kind == 'var') {
            expresion = ' ' + exp.var + ' ';
            expresion = ' undefined ';
    generarFun = function (graph) {
        var funcionString = '';
        var grafica;
        for (var fun of graph.funs) {
            funcionString = 'var ' + fun.fun + ' = function(' + fun.args.join() + '){\n return ' + this.generarF(fun.bdy) + '}\n' + funcionString;

            if (fun.fun == graph.graph) {
                funcionString += 'return ' + fun.fun + '(' + fun.args.join() + ');\n'
                grafica = fun;
            }
        }
        funcionString = '(' + grafica.args.join() + ')=>{\n' + funcionString + '}';