Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Outer Consturctor with Parametric Types + Iterator Question

$
0
0

@sstadick wrote:

When I try to create a Lapper, I get the following error.

julia version 1.1.0
 inputs = [Interval(3, 5, true), Interval(4, 10, false), Interval(7, 12, true), Interval(9, 15, true), Interval(7, 10, true)]
5-element Array{Interval{Bool},1}:
 Interval{Bool}(3, 5, true)
 Interval{Bool}(4, 10, false)
 Interval{Bool}(7, 12, true)
 Interval{Bool}(9, 15, true)
 Interval{Bool}(7, 10, true)

 lapper = Lapper(inputs)
ERROR: MethodError: no method matching Lapper(::Array{Interval{Bool},1})
Closest candidates are:
  Lapper(::Array{Interval{T},1}, ::Int64, ::Int64, ::Union{Nothing, Int64}, ::Bool) where T at main.jl:11
Stacktrace:
 [1] top-level scope at none:0

Why isn’t my constructor listed as a possible method?

Part two of my question is in regards to the find method. I want to return an iterator, and I believe what I have will work, but is it idiomatic / performant?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2795

Latest Images

Trending Articles



Latest Images