-
Notifications
You must be signed in to change notification settings - Fork 21
LazyList.fill and LazyList.tabulate aren't lazy in the head #11083
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
Comments
None of these terminate. If this is intended to be the forever replacement for Stream, I'd think that they would. YMMV.
|
I'm not sure if I agree that I would expect |
In order to have |
It makes enough sense that it already exists as a view:
But of course that doesn't work either.
|
I will agree that At the very least, |
I suggest spinning off the returning to at https://twitter.com/StefanZeiger/status/1030056916981096449 @szeiger wrote of @szeiger are you sure? it seems to me that the possibility of out-of-order evaluation of side-effects is everywhere with
why should to impose order dependence, we offer e.g.
|
it would be worthwhile for |
The whole scaladoc probably needs to be revamped. I didn't touch it at all. I think I will tackle that last, after fixing all the other laziness problems. Edit: or if someone else wants to, I won't stop them - it shouldn't conflict with the code |
wrt
|
@SethTisue do you mind if I broaden this issue to cover all factories/generators with laziness problems? (and the other issue can cover all methods on an instance of |
It seems to me that which factory method I use should not determine the laziness. |
I can see laziness being determined by a factory method when it takes a thunk vs a value. So like I'd expect |
@shawjef3 But there are already factory methods for which |
@NthPortal I guess I misunderstood |
@shawjef3 I don't think it's very useful to talk about whether or not the actual |
My argument for |
hmm, that seems rather convincing, actually. @NthPortal what do you think? |
I'm torn. On the one hand, the argument is convincing to me as well. On the other hand, the only side effects I've seen it used with are On the whole though, I think I agree with @szeiger (and the same for |
Reopening this issue to return |
Uh oh!
There was an error while loading. Please reload this page.
for
LazyList.fill
, I would expect the same output in both cases here:and similarly for
tabulate
:perhaps there are other methods with this problem?
noticed in @paulp's gist: https://gist.github.com/paulp/fac614c6de23c10644a7af25f4ef96e4
tentatively assigning @NthPortal as this is a continuation of scala/scala#7000
methods to fix:
fill
tabulate
The text was updated successfully, but these errors were encountered: