Artifact 274d10aca22ce25f8b3e97da9c868e8c30bbd2bb
1 @macro twice(x) { x; x };
2 @macro max(x,y) {
3 var _x = x; # no hygenic macro btw....
4 var _y = y; # no hygenic macro btw....
5 if(_x<_y){_y}else{_x}
6 };
7 def maxNormal(x,y) {
8 if(x<y){y}else{x}
9 };
10 @macro maxBad(x,y) {
11 if(x<y){y}else{x}
12 };
13
14 @macro LetItBe(x, y) { let it = x in y };
15
16 @macro pow10(x) {
17 @value(
18 def pow(x, n) {
19 if( n == 1 ) { x }
20 else {
21 @macro( @value(x) * @value(pow(x,n-1)) )
22 }
23 }
24 in
25 pow(@macro(x),10)
26 )
27 };
28
29 def printAndReturn(x)
30 {
31 print(x);
32 x
33 };
34
35
36
37
38
39 def main()
40 {
41 twice( print("foo") );
42 print("--------------");
43 print(max(printAndReturn(100),printAndReturn(200)));
44 print("--------------");
45 print(maxNormal(printAndReturn(100),printAndReturn(200)));
46 print("--------------");
47 print(maxBad(printAndReturn(100),printAndReturn(200)));
48 print("--------------");
49 print( LetItBe( 1+2+3, it*it ) );
50 print("--------------");
51 print(pow10(2));
52 };
53
54 main()