On Fri, Sep 23, 2016 at 1:14 PM, Steven G. Johnson <[email protected]>
wrote:

>
>
> On Friday, September 23, 2016 at 2:42:00 AM UTC-4, Michele Zaffalon wrote:
>>
>> On Fri, Sep 23, 2016 at 2:23 AM, Steven G. Johnson <[email protected]>
>> wrote:
>>>
>>>
>>> We could use type inference on the function t -> t^2 (which is buried in
>>> the generator) to determine a more specific eltype.
>>>
>>
>> Does this not require evaluating the function on all inputs thereby
>> losing the advantage of having a generator?
>>
>
> No, not if the eltype of the thing the generator iterates over (in this
> case, an Array{Float64}) is known.
>


Sorry for being slow: the input array rand(10) or the output array, the
square of each element of rand(10)?

julia> (begin;println(t);t^2;end for t=1:10)
Base.Generator{UnitRange{Int64},##37#38}(#37,1:10)

Reply via email to