2 ms·
Bob Nystrom makes this argument best, I think, in his two-parter on loops and iteration[1,2]. Looping over data structures is of course only one example of how
by mananaysiempre 3y ago
Bob Nystrom makes this argument best, I think, in his two-parter on loops and iteration[1,2]. Looping over data structures is of course only one example of how one can apply coroutines, but a very established one. The canonical problem requiring coroutines[3] is also essentially about doing that.
Or for those who want something different there’s the elevator (and elevator-userbase) simulation from TAoCP volume 1, also an essentially concurrent problem with little to no parallelism or I/O to it.
[1] https://journal.stuffwithstuff.com/2013/01/13/iteration-inside-and-out/ https://journal.stuffwithstuff.com/2013/01/13/iteration-insi...
[2] https://journal.stuffwithstuff.com/2013/02/24/iteration-inside-and-out-part-2/ https://journal.stuffwithstuff.com/2013/02/24/iteration-insi...
[3] https://wiki.c2.com/?SameFringeProblem https://wiki.c2.com/?SameFringeProblem