%dw 2.0
var x=(param1, param2) -> { "$param1": param2 }
var y=(param1, param2 = "c") -> { "$param1": param2 }
var toUser = (user) -> { name: user.name,	lastName: user.lastName }
fun z(param1, param2) = { "$param1": param2 }
var a = { name: "Mariano" , toUser: ((param1, param2) -> { "$param1": param2 }) }
var b = log(123)
var applyFirst = (array, func) -> (func(array[0]) ++ array[1 to -1])
fun plus(a,b) = a + b
var pluss = (a,b) -> a + b
fun over(a: String) = "a string"
fun over(a: Number) = "a number"
fun over(a) = "any type"

---
result: {
  a: x("a", "b"),
  b: y("a"),
  c: y("a", "b"),
  users: { (in1 map ((user) -> { user: (toUser(user) ++ user) })) },
  d: z("a", "b"),
  e: a.toUser("name","Mariano"),
  f: a.toUser("name","Mariano").name,
  f: applyFirst("mariano", (s) -> upper(s) ),
  g: "name" z "Leandro",
  h: 1 plus 2 plus 3,
  i: 1 plus (2 plus 3),
  j: plus(1, plus(2, 3)),
  k: 1 pluss 2 pluss 3,
  l: {( map(["mariano","shoki"], (v,i) -> {name: v}) )},
  m: over(123),
  n: over("str"),
  o: over(now)

}
