Diff
Not logged in

Differences From Artifact [d3f621f8aabb3e95]:

To Artifact [6b6d7ff7af65edf2]:


1 # 1 # 2 # Not at all a good example of the usage of layers, but anyway... 2 # Not at all a good example of the usage of layers, but anyway... 3 # 3 # 4 # after implementing layered parameters, this may be improved. < 5 # (though still not a good example...) < 6 # < 7 4 8 @ 3 print(x) { @v(print("Fizz")) }; | 5 @@3(x){x}; 9 @ 5 print(x) { @v(print("Buzz")) }; | 6 @@5(x){x}; 10 @15 print(x) { @v(print("FizzBuzz")) }; | 7 @@15(x){x}; > 8 def incr(x) { x+1 }; > 9 @ 3 incr(x) {@value( if(@ 3(x)+1< 3){@ 3(x)+1}else{0} )}; > 10 @ 5 incr(x) {@value( if(@ 5(x)+1< 5){@ 5(x)+1}else{0} )}; > 11 @15 incr(x) {@value( if(@15(x)+1<15){@15(x)+1}else{0} )}; 11 12 12 def fb(n, q3, q5, q15) { | 13 def fb(n @value @3 @5 @15) { 13 if( q15 < 1 ) { < 14 @15(print) < 15 } else { < 16 if( q5 < 1 ) { < 17 @5(print) | 14 print( 18 } else { < 19 if( q3 < 1 ) { < 20 @3(print) < 21 } else { < 22 @v(print) < 23 } < 24 } < > 15 if( @15(n) ) { if( @5(n) ) { if( @3(n) ) { n } else { "Fizz" } } else { 25 }(n); | 16 ); 26 let q3 = q3+1; < 27 let q5 = q5+1; < 28 let q15 = q15+1; < 29 < 30 fb( | 17 fb(incr(n)) 31 n+1, < 32 if(q3<3){q3}else{0}, < 33 if(q5<5){q5}else{0}, < 34 if(q15<15){q15}else{0} < 35 ) < 36 }; 18 }; 37 19 38 fb(0,0,0,0) | 20 fb(0)