1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 09:17:17 +00:00

Remove function eachy.

Instead use `each`.
This commit is contained in:
Calvin Rose 2021-01-03 16:19:23 -06:00
parent c357af02c2
commit 4355420994
2 changed files with 1 additions and 16 deletions

View File

@ -7,15 +7,6 @@
(print "simple yielding") (print "simple yielding")
(each item f (print "got: " item ", now " (fiber/status f))) (each item f (print "got: " item ", now " (fiber/status f)))
(def f
(coro
(for i 0 10
(yield (string "yield " i))
(ev/sleep 0))))
(print "old style fiber iteration")
(eachy item f (print "got: " item ", now " (fiber/status f)))
(def f (def f
(coro (coro
(for i 0 10 (for i 0 10

View File

@ -514,12 +514,6 @@
[x ds & body] [x ds & body]
(each-template x ds :pairs body)) (each-template x ds :pairs body))
(defmacro eachy
`Resume a fiber in a loop until it has errored or died. Evaluate the body
of the loop with binding set to the yielded value.`
[x fiber & body]
(loop-fiber-template x fiber body))
(defmacro repeat (defmacro repeat
"Evaluate body n times. If n is negative, body will be evaluated 0 times. Evaluates to nil." "Evaluate body n times. If n is negative, body will be evaluated 0 times. Evaluates to nil."
[n & body] [n & body]
@ -568,7 +562,7 @@
* :pairs -- iterate over the key-value pairs as tuples in a data structure. * :pairs -- iterate over the key-value pairs as tuples in a data structure.
* :in -- iterate over the values in a data structure. * :in -- iterate over the values in a data structure or fiber.
* :generate -- iterate over values yielded from a fiber. Can be paired with * :generate -- iterate over values yielded from a fiber. Can be paired with
the generator function for the producer/consumer pattern. the generator function for the producer/consumer pattern.