Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

review iteratorsize for all types #89

Open
CarloLucibello opened this issue Oct 18, 2016 · 4 comments
Open

review iteratorsize for all types #89

CarloLucibello opened this issue Oct 18, 2016 · 4 comments
Milestone

Comments

@CarloLucibello
Copy link
Contributor

CarloLucibello commented Oct 18, 2016

as it was done in #85 for Chain

types: Product, Partition, IMap, Iterate (IsInfinite)

@oxinabox
Copy link
Member

I suggest that before adding more iteratorsize support,
a final julia v0.4 version be tagged,
and the REQUIRE file be updated to need julia 0.5

Iteratorsize is generally functional for 0.4, in its current state,
and keeping it compatible makes this in particular much harder

@iamed2 iamed2 added this to the 1.0.0 milestone Oct 18, 2016
@phipsgabler
Copy link

phipsgabler commented Apr 4, 2017

I run into the following problem:

julia> nth(drop(repeatedly(() -> 1), 1), 1)
ERROR: MethodError: no method matching length(::Iterators.RepeatCallForever)
Closest candidates are:
  length(!Matched::SimpleVector) at essentials.jl:168
  length(!Matched::Base.MethodList) at reflection.jl:256
  length(!Matched::MethodTable) at reflection.jl:322
  ...
 in nth(::Base.Drop{Iterators.RepeatCallForever}, ::Int64) at /home/philipp/.julia/v0.5/Iterators/src/Iterators.jl:497

Since this seems to be due to this line: is this an instance of this issue? Because I can replicate it with

julia> applicable(length, drop(repeatedly(() -> 1), 1))
true

julia> length(drop(repeatedly(() -> 1), 1))
ERROR: MethodError: no method matching length(::Iterators.RepeatCallForever)
Closest candidates are:
  length(!Matched::SimpleVector) at essentials.jl:168
  length(!Matched::Base.MethodList) at reflection.jl:256
  length(!Matched::MethodTable) at reflection.jl:322
  ...
 in length(::Base.Drop{Iterators.RepeatCallForever}) at ./iterator.jl:371

julia> Base.iteratorsize(drop(repeatedly(() -> 1), 1))
Base.IsInfinite()

and I think that checking for IsInfinite somehow should prevent this. But I might also have understood the logic wrong, and the behaviour is due to length...

@iamed2
Copy link
Collaborator

iamed2 commented Apr 4, 2017

@phipsgabler Please file that separately and I'll fix it today :)

@phipsgabler
Copy link

@iamed2 done: #100. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants