-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Length of iterators #41
Comments
Hi This could be implemented by having a @Resumable macro with two inputs. Kind regards Ben |
The length of the iterators may be highly non-trivial to compute at times. I propose the following syntax with the second shorthand. This is slightly longer, but I think covers a wider range of cases. (Ill try to look at the internals and see if I can implement it) @length myfun(n)
# computation of length
return length
end
@length myfun2(n) = n So in the case of baggepinnen, we would write instead @resumable myfun(n)
for i in 1:n
@yield i
end
end
@length myfun(n) = n |
It would be convenient if was possible to supply the length of a resumable function if the length is known. A lot of functions around the ecosystem do not work if they can't ask for the length.
E.g.,
The text was updated successfully, but these errors were encountered: