A beginner's question...

I'm writing a function that wants to load a set of data from a file, 
depending on an argument passed to the function (so a different argument 
requires a different set of data to be loaded). I'd like each set of data 
to be stored somehow in separate variables so that when the function is 
called again with the same argument, it doesn't have to load that 
particular data again (because it takes 5 seconds to load).

I'm not sure whether this requires the use of global variables? I looked 
through the documents (
http://julia.readthedocs.org/en/latest/search/?q=global) but didn't gain 
enlightenment. :)

I think I can test for the existence of a previously-defined variable using:

    if !isdefined(symbol(string(dataset)))
       dataset = include("$(dataset).jl")
    end

but I'm not convinced this works correctly, because this creates a variable 
inside the function...

Reply via email to