Thank René!
There is no difference. identity is defined as "identity(x) = x", and this gets
inlined by the compiler.
You can also check, for example, the output of "@code_native f(1)" and compare
it with g.
Am 30.08.2015 um 16:06 schrieb Diego Javier Zea :
> Thanks!
>
> One more question, what is the di
Thanks!
One more question, what is the difference between this two definitions:
julia> f(x) = x
f (generic function with 1 method)
julia> g(x) = identity(x)
g (generic function with 1 method)
julia> f(10)
10
julia> g(10)
10
Thanks! I didn't know about enum types!
Since functions are first class objects, my answer would be "neither, just
use a function":
methoda = x -> one(typeof(x)) + x
methodb = identity
On Sat, Aug 29, 2015 at 11:17 AM Diego Javier Zea
wrote:
> Hi!
>
> I'm confused with this...
>
> When do I need to use Symbol instead of ASCIIString on
On Sat, Aug 29, 2015 at 11:48 AM, Yichao Yu wrote:
> On Sat, Aug 29, 2015 at 11:17 AM, Diego Javier Zea wrote:
>> Hi!
>>
>> I'm confused with this...
>>
>> When do I need to use Symbol instead of ASCIIString on function arguments?
>>
>> Which of the following is the best and Julian definition?
>
On Sat, Aug 29, 2015 at 11:17 AM, Diego Javier Zea wrote:
> Hi!
>
> I'm confused with this...
>
> When do I need to use Symbol instead of ASCIIString on function arguments?
>
> Which of the following is the best and Julian definition?
Apart from their indented use (symbol in code/expression) symb
Hi!
I'm confused with this...
When do I need to use Symbol instead of ASCIIString on function arguments?
Which of the following is the best and Julian definition?
julia> myfunstr{T}(x::T; method::ASCIIString="one") = method=="one" ? one(T
)+x : x
myfunstr (generic function with 1 method)
ju