Diff
Not logged in

Differences From Artifact [c9a55d8e7b3293ae]:

To Artifact [ed44c7901d3c5853]:


3 else { if( _isstr(x) ) { "str" } 3 else { if( _isstr(x) ) { "str" } 4 else { if( _isfun(x) ) { x } 4 else { if( _isfun(x) ) { x } 5 else { if( _isundefined(x) ) { "undefined" } 5 else { if( _isundefined(x) ) { "undefined" } 6 else { "any" }}}} 6 else { "any" }}}} 7 }; 7 }; 8 8 9 def binop(a,b,c) { 9 def binop(a,b,c) { 10 fun(x,y){@v( | 10 fun(x,y){@value( 11 if( @type(x)=="undefined" || @type(y)=="undefined" ) { "undefined" } else { 11 if( @type(x)=="undefined" || @type(y)=="undefined" ) { "undefined" } else { 12 if( @type(x)==a && @type(y)==b ) { c } else { "error" } 12 if( @type(x)==a && @type(y)==b ) { c } else { "error" } 13 } 13 } 14 )} 14 )} 15 }; 15 }; 16 16 17 @type "+" = binop("int", "int", "int"); 17 @type "+" = binop("int", "int", "int"); ................................................................................................................................................................................ 19 @type "<" = binop("int", "int", "int"); 19 @type "<" = binop("int", "int", "int"); 20 @type ">" = binop("int", "int", "int"); 20 @type ">" = binop("int", "int", "int"); 21 21 22 def mergeType(a,b) { 22 def mergeType(a,b) { 23 if( a == "undefined" ) { if(b=="undefined"){"error"}else{b} } else { a } 23 if( a == "undefined" ) { if(b=="undefined"){"error"}else{b} } else { a } 24 }; 24 }; 25 25 26 @type "if" = fun(c,t,e) {@v( | 26 @type "if" = fun(c,t,e) {@value( 27 if(@type(c)=="int" ) { mergeType(@type(t()), @type(e())) } else { "error" } 27 if(@type(c)=="int" ) { mergeType(@type(t()), @type(e())) } else { "error" } 28 )}; 28 )};