Lazy.jl icon indicating copy to clipboard operation
Lazy.jl copied to clipboard

cannot construct nested lists

Open chfin opened this issue 7 years ago • 1 comments

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 avatar Jan 14 '18 12:01 chfin

The suggested fix is applied in #76.

chfin avatar Jan 14 '18 18:01 chfin