Differences From Artifact [f80a12af3228ea33]:
- File
sample/type.pmy
- 2010-11-24 12:14:00 - part of checkin [3ae09b8cbf] on branch trunk - changed if-then-else syntax (user: kinaba) [annotate]
To Artifact [12b974146da19906]:
- File
sample/type.pmy
- 2010-11-24 17:44:58 - part of checkin [b993a8ad16] on branch trunk - auto memo and re-run feature of non @value/@macro layers re-re-re-implemented. (user: kinaba) [annotate]
20 def mergeType(a,b) { 20 def mergeType(a,b) {
21 if( a == "undefined" ): ( if(b=="undefined"):"error" else b ) else ( a ) 21 if( a == "undefined" ): ( if(b=="undefined"):"error" else b ) else ( a )
22 }; 22 };
23 23
24 @type "if" = fun(c,t,e) {@value( 24 @type "if" = fun(c,t,e) {@value(
25 if(@type(c)=="int" ): mergeType(@type(t()), @type(e())) else : "error" 25 if(@type(c)=="int" ): mergeType(@type(t()), @type(e())) else : "error"
26 )}; 26 )};
> 27
> 28 def fib(x)
> 29 {
> 30 if x<2 then 1 else fib(x-1) + fib(x-2)
> 31 };
> 32
> 33 print( @type(fib(10)) );