@eaton How did you get assigning fields to the r function to type-check?! And why not just use local variables for index and items?
Notices by mb21 (mb21@hachyderm.io)
-
Embed this notice
mb21 (mb21@hachyderm.io)'s status on Sunday, 26-May-2024 23:39:42 JST mb21 -
Embed this notice
mb21 (mb21@hachyderm.io)'s status on Sunday, 26-May-2024 23:39:41 JST mb21 @eaton Sorry, couldn’t help myself to write it as a generator function (which return iterators with a .next method):
function * makeRotator (items) {
let i = 0
while (true) {
yield items[i % items.length]
i++
}
}but yeah, not sure it’s worth the complexity…
-
Embed this notice
mb21 (mb21@hachyderm.io)'s status on Friday, 22-Dec-2023 05:05:47 JST mb21 @thomasfuchs @codinghorror in retrospect, none of us were.