(of course .. ) thank you

On Monday, August 3, 2015 at 7:49:11 PM UTC-4, Seth wrote:
>
> Your errors are with the typo in "Furniture" (which leads to ERROR: 
> UndefVarError: Furniture not defined) and the parentheses around your type 
> parameterization here:
>
> julia> f({T <: Furnature})(::Type{T}) = 10
>
> The correct function definition should be
>
> julia> f{T <: Furniture}(::Type{T}) = 10
>
>
>
> On Monday, August 3, 2015 at 4:44:31 PM UTC-7, Jeffrey Sarnoff wrote:
>>
>> would you mind updating this, I just ran it and did not know how to 
>>    change " {T <: Furnature}" to "Use Any[a,b, ..] instead", thank you
>>
>> julia> abstract Furnature
>>
>> julia> type Table <: Furnature
>>        end
>>
>> julia> f({T <: Furnature})(::Type{T}) = 10
>>
>> WARNING: deprecated syntax "{a,b, ...}".
>> Use "Any[a,b, ...]" instead.
>> ERROR: syntax: invalid method name "f({T<:Furnature})"
>>
>> julia> f(::Furnature) = 17
>> f (generic function with 1 method)
>>
>> julia> f(Furniture)
>> ERROR: UndefVarError: Furniture not defined
>>
>> julia> f(Table)
>> ERROR: MethodError: `f` has no method matching f(::Type{Table})
>>
>> julia> f(Table())
>> 17
>>
>>
>>
>> On Thursday, July 23, 2015 at 1:59:43 PM UTC-4, Tom Breloff wrote:
>>>
>>> And to be complete, depending on your use-case:
>>>
>>> julia> abstract Furniture
>>>
>>> julia> type Table <: Furniture end
>>>
>>> julia> f(::Furniture) = 10
>>> f (generic function with 1 method)
>>>
>>> julia> f(Table())
>>> 10
>>>
>>>
>>>
>>> On Thursday, July 23, 2015 at 1:01:39 PM UTC-4, Vinuth Madinur wrote:
>>>>
>>>> Yes!
>>>>
>>>> Thats awesome.
>>>>
>>>> Thanks,
>>>> Vinuth.
>>>>
>>>>
>>>> On Thursday, July 23, 2015 at 10:10:04 PM UTC+5:30, Seth wrote:
>>>>>
>>>>> Is this what you're looking for?
>>>>>
>>>>> julia> abstract Furniture
>>>>>
>>>>> julia> type Table <: Furniture end
>>>>>
>>>>> julia> f{T<:Furniture}(::Type{T}) = 10
>>>>> f (generic function with 1 method)
>>>>>
>>>>> julia> f(Furniture)
>>>>> 10
>>>>>
>>>>> julia> f(Table)
>>>>> 10
>>>>>
>>>>>
>>>>>
>>>>> On Thursday, July 23, 2015 at 9:34:12 AM UTC-7, Vinuth Madinur wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is there a way to do function dispatch on subtypes? For example, 
>>>>>> consider the following:
>>>>>>
>>>>>> > abstract Furniture
>>>>>>
>>>>>> > type Table <: Furniture end
>>>>>>
>>>>>> > f(::Type{Furniture}) = 10
>>>>>>
>>>>>> > f(Furniture)
>>>>>> 10
>>>>>>
>>>>>> > f(Table)
>>>>>> Error.....
>>>>>>
>>>>>> How do I enable the same function to be called when I do f(Table)?
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Vinuth.
>>>>>>
>>>>>>

Reply via email to