Correct use of delegation?

I’m in my first week of learning Kotlin. I’m using it to re-write my Prolog language implementation (I find writing a compiler for another language is a good way to learn a new language)

Is the following the best way of doing what I’m attempting?

class Clause(tokens:MutableList) : MutableList by tokens

fun newClause():Clause{
val tokens : MutableList = mutableListOf()
return Clause(tokens)
}//----
//+++++++++++++++++++++++++++++++++++++++++++++

class Clauses(listOfClauses:MutableList) : MutableList by listOfClauses

fun newClauses():Clauses{
val clauses : MutableList = mutableListOf()
return Clauses(clauses)
}//----
//+++++++++++++++++++++++++++++++++++++++++++++

val myClauses = newClauses()

Whoops! Didn’t spot the need for special treatment of > and <

Here;'s another attempt to post the code, using ‘preformatted’:

class Clause(tokens:MutableList<Token>) : MutableList<Token> by tokens

fun newClause():Clause{
val tokens : MutableList<Token> = mutableListOf()
return Clause(tokens)
}//----
//+++++++++++++++++++++++++++++++++++++++++++++

class Clauses(listOfClauses:MutableList<Clause>) : MutableList<Clause> by listOfClauses

fun newClauses():Clauses{
val clauses : MutableList<Clause> = mutableListOf()
return Clauses(clauses)
}//----
//+++++++++++++++++++++++++++++++++++++++++++++

val myClauses = newClauses()

It’s be a lot easier to read if you did:

```kotlin
<code>
```

to format your code.