Diff
Not logged in

Differences From Artifact [d3f621f8aabb3e95]:

To Artifact [6b6d7ff7af65edf2]:


1 1 # 2 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")) }; 9 -@ 5 print(x) { @v(print("Buzz")) }; 10 -@15 print(x) { @v(print("FizzBuzz")) }; 5 +@@3(x){x}; 6 +@@5(x){x}; 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 - if( q15 < 1 ) { 14 - @15(print) 15 - } else { 16 - if( q5 < 1 ) { 17 - @5(print) 18 - } else { 19 - if( q3 < 1 ) { 20 - @3(print) 21 - } else { 22 - @v(print) 23 - } 24 - } 25 - }(n); 26 - let q3 = q3+1; 27 - let q5 = q5+1; 28 - let q15 = q15+1; 29 - 30 - fb( 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 - ) 13 +def fb(n @value @3 @5 @15) { 14 + print( 15 + if( @15(n) ) { if( @5(n) ) { if( @3(n) ) { n } else { "Fizz" } } else { "Buzz" } } else { "FizzBuzz" } 16 + ); 17 + fb(incr(n)) 36 18 }; 37 19 38 -fb(0,0,0,0) 20 +fb(0)