1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-13 05:47:14 +00:00

Merge pull request #1157 from zevv/file-lines

Add file/lines iterator
This commit is contained in:
Calvin Rose
2023-05-26 18:16:14 -05:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -1746,6 +1746,14 @@
(printf (dyn *pretty-format* "%q") x)
(flush))
(defn file/lines
"Return an iterator over the lines of a file."
[file]
(coro
(while (def line (file/read file :line))
(yield line))))
###
###
### Pattern Matching