Differences From Artifact [ed44c7901d3c5853]:
- File
sample/type.pmy
- 2010-11-21 15:48:16 - part of checkin [f86026acb8] on branch trunk - macro cache and automemoization reloaded. auto re-run implemented. but automemo and autorerun is currently disabled. we need Table.opCmp... we also need to think more about the memoization (user: kinaba) [annotate]
To Artifact [b35cfd66e862f7bf]:
- File
sample/type.pmy
- 2010-11-21 16:05:20 - part of checkin [da7559b744] on branch trunk - fizzbuzz sample changed (user: kinaba) [annotate]
1 @@type = fun(x){ 1 @@type = fun(x){
2 if( _isint(x) ) { "int" } 2 if( _isint(x) ) { "int" }
3 else { if( _isstr(x) ) { "str" } 3 else { if( _isstr(x) ) { "str" }
4 else { if( _isfun(x) ) { x } <
5 else { if( _isundefined(x) ) { "undefined" } 4 else { if( _isundefined(x) ) { "undefined" }
6 else { "any" }}}} | 5 else { "any" }}}
7 }; 6 };
8 7
9 def binop(a,b,c) { 8 def binop(a,b,c) {
10 fun(x,y){@value( 9 fun(x,y){@value(
11 if( @type(x)=="undefined" || @type(y)=="undefined" ) { "undefined" } else { 10 if( @type(x)=="undefined" || @type(y)=="undefined" ) { "undefined" } else {
12 if( @type(x)==a && @type(y)==b ) { c } else { "error" } 11 if( @type(x)==a && @type(y)==b ) { c } else { "error" }
13 } 12 }