I think it just uses getindex (a bit of a hack...):

julia> @which Int[3]
getindex(T::Union(DataType,UnionType,TypeConstructor),vals...) at array.jl:119


On Wed, 2015-06-17 at 14:50, andrew cooke <[email protected]> wrote:
> Oh, I think the call() thing is just me being confused.  That's *only* a 
> mechanism to allow non-functions to look like functions?  I guess my 
> misunderstanding is more about how apply is defined (it mentions call), 
> which really isn't important to me right now, so feel free to ignore that 
> part of my question.  Sorry.
>
>
> On Wednesday, 17 June 2015 09:45:46 UTC-3, andrew cooke wrote:
>>
>>
>> If I want to pass the function that constructs an array of Any, given some 
>> values, to another function, what do I use?
>>
>> Here's an example that might make things clearer:
>>
>> julia> f(x...) = Any[x...]
>> f (generic function with 1 method)
>>
>> julia> apply(f, 1,2,3)
>> 3-element Array{Any,1}:
>>  1
>>  2
>>  3
>>
>> julia> apply(Any[], 1,2,3)
>> ERROR: MethodError: `call` has no method matching call(::Array{Any,1}, ::
>> Int64, ::Int64, ::Int64)
>> Closest candidates are:
>>   BoundsError(::Any...)
>>   TypeVar(::Any...)
>>   TypeConstructor(::Any...)
>>   ...
>>  in apply at deprecated.jl:116
>>
>> where I am looking for what the built-in equivalent of f() is.
>>
>> I may be even more confused, because I also don't understand why this 
>> fails:
>>
>> julia> call(f, 1, 2)
>> ERROR: MethodError: `call` has no method matching call(::Function, ::Int64
>> , ::Int64)
>> Closest candidates are:
>>   BoundsError(::Any...)
>>   TypeVar(::Any...)
>>   TypeConstructor(::Any...)
>>   ...
>>
>> So any guidance appreciated.
>>
>> Thanks,
>> Andrew
>>

Reply via email to