The first case is a little complicated, and there are several tricky issues 
involved in passing types like arrays of arrays.  But you're right, the 
second method should work just as well — it looks like you've forgotten 
either your seed or the sim_time when you tried to call run (there's only 
one Int64 argument before your time_file).

For the first case, you'll want to use a parametric method 
(http://docs.julialang.org/en/release-0.3/manual/methods.html#parametric-methods),
 
paying careful attention to type invariance 
(http://docs.julialang.org/en/release-0.3/manual/types.html?highlight=invariant#man-parametric-types).
 
 And then you'll need to make sure that all methods that create your arrays 
of arrays are type stable in order for the method to match.  In general, 
I've found this to be not worth the hassle — there's no generally no need 
to make your method signatures that precise.

On Monday, March 2, 2015 at 3:23:27 PM UTC-5, Michael Bullman wrote:
>
> Hi all, 
>
> First off thanks for all the help I've gotten the last few weeks in this 
> group. It's been very helpful. 
>
>
> I want to pass an Array of Arrays to a run() function I have in a small 
> simulation program. When I do typeof() of my data structure in the command 
> line (REPL?) I get
>
> julia> typeof(time_test) 
>
> Array{Array{Fyle,N},1}
>
> Where "Fyle" is a type I made with some properties like filesize, and other 
> fields. 
>
> My question is, when I try to pass this data structure to my run() function I 
> get the a few different errors messages, depending on how I try to implement 
> it. 
>
> First Attempt:
> function run(algo::String, path1::String, path2::String, path3::String, 
> path4::String, path5::String, seed::Int64, sim_time::Int64, 
> time_file::Array{Array{Fyle,N},1})
>
> Error message: 
> ERROR: N not defined
>  in include at /usr/bin/../lib64/julia/sys.so
>  in include_from_node1 at /usr/bin/../lib64/julia/sys.so
>
> I then made a couple attempts to get rid of N but they all threw errors, so 
> then I thought. I'll just define the variable name and get rid of typing
>
> 2nd Attempt:
> function run(algo::String, path1::String, path2::String, path3::String, 
> path4::String, path5::String, seed::Int64, sim_time::Int64, time_file)
>
> Error:
> ERROR: `run` has no method matching run(::ASCIIString, ::ASCIIString, 
> ::ASCIIString, ::ASCIIString, ::ASCIIString, ::ASCIIString, ::Int64, 
> ::Array{Array{Fyle,N},1})
>
> I thought if I didn't try to declare a type it would just accept the data 
> structure, but this doesn't seem to be the case. 
>
>
> any help is greatly appreciated
>
> Thanks 
>

Reply via email to