# Outer Consturctor with Parametric Types + Iterator Question

**URL:** <https://discourse.julialang.org/t/outer-consturctor-with-parametric-types-iterator-question/29783>\
**Category:** New to Julia\
**Created:** [October 11, 2019, 4:30pm UTC](https://discourse.julialang.org/t/outer-consturctor-with-parametric-types-iterator-question/29783 "2019-10-11T16:30:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sstadick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sstadick/32/10776_2.png) [@sstadick](https://discourse.julialang.org/u/sstadick)\
**Post date:** [October 11, 2019, 4:30pm UTC](https://discourse.julialang.org/t/outer-consturctor-with-parametric-types-iterator-question/29783/1 "2019-10-11T16:30:27Z")

</div>

[https://repl.it/repls/HilariousDentalBlocks](https://repl.it/repls/HilariousDentalBlocks)

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

```julia
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?

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [October 11, 2019, 4:41pm UTC](https://discourse.julialang.org/t/outer-consturctor-with-parametric-types-iterator-question/29783/2 "2019-10-11T16:41:49Z")

</div>

Drop the `{T}` in the definition of the constructor `Lapper{T}(intervals::Vector{Interval{T}}) where T` and you should be fine.

I.e. make it `Lapper(intervals::Vector{Interval{T}}) where T`
