I think what's happening is the compiler can't figure out the specific type 
of t, so s becomes an array of Any. It works for me if I do
const t = [1:10]

See 
http://docs.julialang.org/en/release-0.3/manual/performance-tips/#avoid-global-variables

When s is an array of Any the problem comes from how the implementation of 
variance tries to give you back the same type you'd get if you took the 
mean of the elements of s by looking at (0 + 0) / 2 for that type.  Since 
it can't figure out the specific type of s, it runs into a problem.

On Tuesday, November 18, 2014 2:27:27 PM UTC-8, witek gawlowski wrote:
>
>
>
> Hello, 
> some basic question although i couldn't find an answer easily:
>
> if i run 
> using StatsBase
> t = [1:10]
> s = [sum(t[1:i]) for i=1:10]
> var(s)
>
> i get an error: `zero` has no method matching zero(::Type{Any})
>
> I see t is of [a, b, c] type and s is of {a, b, c} type. Can you give me 
> the topics to search for?
> also if s is representing a list why do i have to convert it to something 
> else (i guess) to calculate its variance?
>
> Regards
>

Reply via email to