%dw 2.0

fun foreach(elements: Array<() -> Any>): Any =
    if(isEmpty(elements))
        null
    else do {
        var head = elements[0]()
        ---
        foreach (elements[1 to -1] default [])
    }
---
foreach([() -> null])