next can be used on fiber, but the doc text doesn't mention that.
❯ janet
Janet 1.32.1-1ccd544b linux/x64/gcc - '(doc)' for help
repl:1:> (doc next)
function
(next ds &opt key)
Gets the next key in a data structure. Can be used to iterate
through the keys of a data structure in an unspecified order. Keys
are guaranteed to be seen only once per iteration if they data
structure is not mutated during iteration. If key is nil, next
returns the first key. If next returns nil, there are no more keys
to iterate through.
nil
repl:3:> (def a (file/lines (file/open "/etc/passwd")))
<fiber 0x555844673640>
repl:4:> (next a nil)
0
repl:5:> (next a 0)
0
repl:6:> (next a 1)
0
repl:7:> (next a 2)
0
repl:8:>
It says
Keys are guaranteed to be seen only once per iteration if they data structure is not mutated during iteration.
a fiber is not commonly known as "data structure"
the fiber self-mutates. "mutated during iteration" is closer to "mutated from the outside"
next
can be used on fiber, but the doc text doesn't mention that.It says