orangy
data class Country(val name: String, code: String, cities: MutableList<City>)
data class City(val name: String)
fun country(objarg country: Country, configure: Country.()->Unit) = country.apply(configure)
fun Country.city(objarg city: City, configure: City.()->unit) = city.apply(configure).apply { cities.add(this) }
// using
country(”Russia”, “RU”) {
city(”Moscow”)
city(”St.Petersburg”)
}