The whole answer can be ``` class ListBuilder<...
# dsl
j
The whole answer can be
Copy code
class ListBuilder<T>() {
   val list = listOf<T>()

   operator fun Any.unaryPlus() { list += this }
}

fun <T> listOfAnything(builder : ListBuilder<T>.() -> Unit) 
     = ListBuilder<T>().apply(builder).list