Of the variations I timed, all with the signature test(a::Tuple), this ran 
fastest:

using FastAnonymous

fa = @anon x->floor(Integer,x)

function test(a::Tuple)
     [x->fa(x) for x in a]
end

I do not know how to access the tuple that is the args as passed directly.
Good question, it raises others.


On Tuesday, September 1, 2015 at 2:34:57 PM UTC-4, Seth wrote:
>
> More precisely,
>
> foo(a::Real...) = map(x->floor(Integer,x),a)
>
>
>
> On Tuesday, September 1, 2015 at 11:32:15 AM UTC-7, Seth wrote:
>>
>> Assuming you have such a conversion function available (let's use floor() 
>> for our example), you could do
>> a = (1.1, 2.2, 3.3, 4.4)
>> map(x->floor(Integer,x), a)
>>
>>
>> which yields a tuple of ints. I don't claim "best" or even "Julian"; 
>> there may be a more clever approach. :)
>>
>>
>> On Tuesday, September 1, 2015 at 11:02:00 AM UTC-7, Scott Jones wrote:
>>>
>>> What is the best Julian way of performing a conversion on all of the 
>>> arguments to a method?
>>> Say I have a tuple, passed in as I::Real..., and I wish to convert all 
>>> of the values to type Int?
>>>
>>> Thanks,
>>> Scott
>>>
>>>

Reply via email to