fun f(a: Array<String>, collect:String = "") =
    using(empty = isEmpty(a), 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"])