Hi Aleksandr,

1. I still don't understand what exactly parametric types do. I mean what 
is the reason to use 

type A{Int64}
A1::Int64
A2::Int64
end

 
instead of

type A
> A1::Int64
> A2::Int64
> end

?


On Saturday, November 28, 2015 at 4:38:41 PM UTC+8, Aleksandr Mikheev wrote:
>
> Hi all. I have 3 questions.
>
>
> 1. I still don't understand what exactly parametric types do. I mean what 
> is the reason to use 
>
> type A{Int64}
>> A1::Int64
>> A2::Int64
>> end
>
>  
> instead of
>
> type A
>> A1::Int64
>> A2::Int64
>> end
>
> ?
> Or am I misunderstanding something?
>
> 2. How should I use types like Int16 or Float16 correctly? I have some 
> function 
>
> GeometryFunc(L::Int16,phi::Float16,distribution::Array{Float16,2}) 
>
>
> But when I try to input something like this:
>
> GeometryFunc(100, 0.3, [0.95 1.01 1.03; 0.25 0.5 0.25])
>
>
> I have got the error. 
>
> ERROR: MethodError: 'GeometryFunc' has no method match no method matching 
>> GeometryFunc(::Int64, ::Float64, ::Array{Float64,2})
>
>
> I guess there are some problems with data I try to input. Or should I try 
> to search something in the code?
>
> 3. How can I delete elements with specific indexes in the array? Or how 
> can I delete all elements, except ones with specific indexes (this is what 
> I am trying to do actually)? For example, I have s = [2, 4, 3, 6, 8, 9, 11] 
> and I want to delete 3rd, 5th and 6th elements (or save 1st, 2nd, 4th and 
> 7th). I know I could do something like:
>
> indx = [3, 5, 6]
>
> for i = 1:1:length(indx)
>
> splice!(s,indx[i])
>
> end
>
>  
> but is there any easier way? The closest thing I found was:
>
> splice(s, k:m)
>
> which removes all elements with indexes from k to m., but this is not what 
> I want exactly. 
>

Reply via email to