totally untested and with iterator: ``` commands....
# announcements
u
totally untested and with iterator:
Copy code
commands.listIterator().run {
       forEach {
           when (it) {
               is Clear -> plot.clear()
               is AddPoints -> plot.addPoints(it.x, it.y)
               is AddPoint -> plot.addPoint(it.x, it.y)
           }
           remove()
       }
   }