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,26 @@
define square(x: Integer): Integer
{
return x * x
}
var l = [1, 2, 3] # Inferred type: List[Integer].
# Transform using a user-defined function.
print(l.map(square)) # [1, 4, 9]
# Using a built-in method this time.
print(l.map(Integer.to_s)) # ["1", "2", "3"]
# Using a lambda (with the type of 'x' properly inferred).
print(l.map{|x| (x + 1).to_s()}) # ["2", "3", "4"]
# In reverse order using F#-styled pipes.
Boolean.to_i |> [true, false].map |> print
define apply[A, B](value: A, f: Function(A => B)): B
{
return f(value)
}
# Calling user-defined transformation.
print(apply("123", String.parse_i)) # Some(123)