%dw 2.0

fun myFunDifArity(name: String) = name ++ "Fun1"

fun myFunDifArity(name: String, number: Number) = name ++ "Fun2"


fun myFunDefaultMethod(name: String, number: Number=1) = name ++ number

fun myFunDefaultMethod(number1: Number, number2: Number=2) = number1 + number2


fun fullOverloaded(name: String, number: Number=1) = name ++ number

fun fullOverloaded(number1: Number, number2: Number=2) = number1 - number2

fun fullOverloaded(boolean1: Boolean, boolean2:Boolean, boolean3:Boolean) = boolean1 or boolean2 and boolean3


fun callerWithNumber(callback: (Number) -> Number) = callback(1)

fun callerWithString(callback: (String) -> String) = callback("Mariano")

fun dict(stringDict: {_ : String}) = stringDict.foo

fun dict(numberDict: {_ : Number}) = numberDict.bar

fun a() = "1"
fun a(test) = "2"
fun a(test, test2) = "3"

---
{
    a: myFunDifArity("This is "),
    b: myFunDifArity("This is ", 2),
    c: myFunDefaultMethod("Mariano "),
    d: myFunDefaultMethod("Mariano ", 2),
    e: myFunDefaultMethod(1),
    f: myFunDefaultMethod(1, 4),
    g: fullOverloaded("Shoki"),
    h: fullOverloaded("Shoki", 23),
    i: fullOverloaded(true, true, true),
    j: callerWithNumber(fullOverloaded),
    k: callerWithString(myFunDefaultMethod),
    l: dict({foo: "Mariano"}),
    m: dict({bar: 32}),
    n: a(in0)
}