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,30 @@
func hashJoin(table1, index1, table2, index2) {
var a = []
var h = Hash()
# hash phase
table1.each { |s|
h{s[index1]} := [] << s
}
# join phase
table2.each { |r|
a += h{r[index2]}.map{[_,r]}
}
return a
}
var t1 = [[27, "Jonah"],
[18, "Alan"],
[28, "Glory"],
[18, "Popeye"],
[28, "Alan"]]
var t2 = [["Jonah", "Whales"],
["Jonah", "Spiders"],
["Alan", "Ghosts"],
["Alan", "Zombies"],
["Glory", "Buffy"]]
hashJoin(t1, 1, t2, 0).each { .say }