My personal style rule: never use a list comprehension that's untyped. This 
will solve your problems:

A = ASCIIString[fun(i) for i = 1:3]]

 -- John

On Oct 29, 2014, at 10:45 AM, Zenna Tavares <[email protected]> wrote:

> As shown in the following example, I am getting differently typed arrays 
> depending on where I use the list comprehension.
> 
> f(i) = "$i"
> A = [f(i) for i = 1:3]
> function makestring(fun)
>   A = [fun(i) for i = 1:3]
> end
> B = makestring(f)
> 
> In this example A has type Vector{ASCIIString} while B has type Vector{Any}.  
> What gives? And is there a workaround such that we get a more specific type?
> 
> I understand there are some open issues related to this, but I am not sure if 
> this case comes under what's already been discussed.
> 
> 

Reply via email to