Hi,
You can get the length of a StepRange:
*julia> **length(2:1:9)*
*8*
But if I try to do so inside a function I get an error about not finding a
call method:
*julia> **function myfun(width::Int, step::Int, length::Int)*
* clip = Int(floor(width / 2))*
* start = 1 + clip*
* stop = length - clip*
* range = StepRange(start, step, stop)*
* return length(range)*
*end*
*myfun (generic function with 1 method)*
*julia> **myfun(3, 1, 10)*
*ERROR: MethodError: `call` has no method matching call(::Int64,
::StepRange{Int64,Int64})*
Closest candidates are:
BoundsError()
BoundsError(*::Any...*)
DivideError()
...
in myfun at none:6
I don't know why this is, the range constructed with the function call
`myfun(3,1,10` should be the same range as 2:1:9. Why is this happening?
Thanks,
Ben.