Diff
Not logged in

Differences From Artifact [3044d19024152b10]:

To Artifact [2c8664960dfdd96b]:


1 1 def fromTo(x, y) 2 2 { 3 - if( x > y ) { {} } 4 - else { {car: x, cdr: fromTo(x+1,y)} } 3 + if x > y : {} 4 + else : {car: x, cdr: fromTo(x+1,y)} 5 5 }; 6 6 7 7 def length(lst) 8 8 { 9 - case( lst ) 10 - when( {car:_, cdr:x} ) { length(x)+1 } 11 - when( _ ) { 0 } 9 + case lst 10 + when {car:_, cdr:x}: length(x)+1 11 + when _: 0 12 12 }; 13 13 14 14 def adjSum(lst) 15 15 { 16 - case( lst ) 17 - when( {car:x, cdr:{car: y, cdr:z}} ) { {car: x+y, cdr: adjSum(z)} } 18 - when( {car:x, cdr:{}} ) { {car: x, cdr: {}} } 19 - when( {} ) { {} } 16 + case lst 17 + when {car:x, cdr:{car: y, cdr:z}} : {car: x+y, cdr: adjSum(z)} 18 + when {car:x, cdr:{}}: {car: x, cdr: {}} 19 + when {}: {} 20 20 }; 21 21 22 22 var xs = fromTo(1,101); 23 23 24 24 print( xs ); 25 25 print( length(xs) ); 26 26 print( adjSum(xs) ); 27 27 print( length(adjSum(xs)) );