fun f(a: Array<String>, collect:String = "") = do {
        var empty = isEmpty(a)
        var head = a[0]
        ---
        if(empty)
            collect
        else if(head == "Clear")
            f(a[1 to -1])
        else
            f(a[1 to -1],  collect ++ head)
   }
---
f(["Read", "Clear", "Read" , "Foo"])