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,31 @@
class BinaryTree<Data>(shared Data data, shared BinaryTree<Data>? left = null, shared BinaryTree<Data>? right = null) {
shared BinaryTree<NewData> myMap<NewData>(NewData f(Data d)) =>
BinaryTree {
data = f(data);
left = left?.myMap(f);
right = right?.myMap(f);
};
}
shared void run() {
value tree1 = BinaryTree {
data = 3;
left = BinaryTree {
data = 4;
};
right = BinaryTree {
data = 5;
left = BinaryTree {
data = 6;
};
};
};
tree1.myMap(print);
print("");
value tree2 = tree1.myMap((x) => x * 333.33);
tree2.myMap(print);
}