This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorize (x) { | |
for (var i = 2 ; i <= Math.sqrt(x) ; i++) { | |
if (x % i === 0) return [i].concat(factorize(x/i)); | |
} | |
return [x]; | |
} | |
function f (x) { | |
var numbers = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Blocking scope | |
let(valuse){} | |
for(let values){} | |
//Tuples | |
(val1,val2) | |
//List expressions,range,reduce,guard | |
[a*a | list->a] | |
[1,3..33] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last = (new Date).getTime(); | |
str = ''; | |
for(a=0,b=0,c=0,d=0,f=0;a<1000,b<1000,c<1000,d<1000,f<1000;a++,b++,c++,d++,f++){ | |
str += 'Number %0 %1 %2 %3 %4'.format(a,b,c,d,f); | |
} | |
print((new Date).getTime() - last) | |
last = (new Date).getTime(); | |
str = ''; | |
for(a=0,b=0,c=0,d=0,f=0;a<1000,b<1000,c<1000,d<1000,f<1000;a++,b++,c++,d++,f++){ |