Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,25 @@
func calculator({.is_one} ) { 1 }
func calculator(n {.is_even}) { n / 2 }
func calculator(n ) { 3*n + 1 }
func succ(this {_{:value}.is_one}, _) {
return this
}
func succ(this, get_next) {
this{:value} = get_next(this{:value})
this{:count}++
return this
}
var enviornments = (1..12 -> map {|i| Hash(value => i, count => 0) });
while (!enviornments.map{ _{:value} }.all { .is_one }) {
say enviornments.map {|h| "%4s" % h{:value} }.join;
enviornments.range.each { |i|
enviornments[i] = succ(enviornments[i], calculator);
}
}
say 'Counts';
say enviornments.map{ |h| "%4s" % h{:count} }.join;