julia> function foo()
         Task() do
           for i in 1:3
             produce(i)
           end
         end
       end
foo (generic function with 1 method)

julia> map(x->2x, foo())
3-element Array{Any,1}:
 2
 4
 6

i guess there is no way to force that to Vector{Int}?

On Sunday, 29 December 2013 14:03:29 UTC-3, John Myles White wrote:
>
> Errrr, make that the type of the output. map often produces Array{Any} 
> when you wanted something like Array{Float64}. 
>
>  — John 
>
> On Dec 29, 2013, at 11:58 AM, andrew cooke <[email protected]<javascript:>> 
> wrote: 
>
> > From the comment at https://gist.github.com/nalimilan/8132114 
> > (am I reading it wrong, does it just mean map with local anon 
> functions?) 
> > 
> > Is it the overhead of creating an intermediate Task?  Are there any 
> plans to merge nested tasks as an optimisation (I have no idea if something 
> like that is even possible)?  Or to replace the "collect(map(...))" idiom 
> with something faster? 
> > 
> > Thanks, 
> > Andrew 
>
>

Reply via email to