Depends on what you want. If it is part of something larger but want to keep it in a separate file, you can just include it --- this is a standard solution for writing more complex modules.
On Fri, Sep 09 2016, Neal Becker wrote: > K leo wrote: > >> The module name needs to be the same as the file, so in this case you need >> to change the function name. >> >> On Friday, September 9, 2016 at 9:29:48 PM UTC+8, Neal Becker wrote: >>> >>> Let's say I have a simple module which contains 1 function called "foo" >>> >>> I might create foo.jl that contains >>> >>> ----foo.jl >>> module foo >>> >>> function foo ... >>> end >>> >>> end >>> >>> This doesn't work, it seems the module name collides with the function >>> name. >>> >>> ----foo.jl >>> module foo_mod >>> >>> function foo ... >>> end >>> >>> end >>> >>> This might be OK, but provokes a warning (here foo -> coef_from_func) >>> julia> using coef_from_func >>> WARNING: requiring "coef_from_func" in module "Main" did not define a >>> corresponding module. >>> >>> So as a newb, what is the basic way to package up a function like this? >>> >>> > > If I want a file that just defines 1 function, should I be using a module? > Is there a better alternative?