MikeInnes / Lazy.jl

I was gonna maintain this package, but then I got high
Other
470 stars 54 forks source link

cannot construct nested lists #75

Open chfin opened 6 years ago

chfin commented 6 years ago

The following fails:

julia> list(list(1), list(1))

with

ERROR: MethodError: colon(::Lazy.LinkedList, ::Lazy.LinkedList) is ambiguous. Candidates:
  colon(x, xs::Lazy.List) in Lazy at /home/chfin/.julia/v0.6/Lazy/src/Lazy.jl:62
  colon(start::T, stop::T) where T in Base at range.jl:9
Possible fix, define
  colon(::T<:Lazy.List, ::T<:Lazy.List)
Stacktrace:
 [1] list(::Lazy.LinkedList, ::Lazy.LinkedList, ::Vararg{Lazy.LinkedList,N} where N) at /home/chfin/.julia/v0.6/Lazy/src/Lazy.jl:66
 [2] macro expansion at ./REPL.jl:97 [inlined]
 [3] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73

I think the problem is that in the nested case the arguments of the colon operator are both lists, so method from Base applies as well. As the error message suggests, an explicit method for this case should fix the problem.

chfin commented 6 years ago

The suggested fix is applied in #76.