Uses an internal parser to read settings in the cleanest possible way.
Example:
s = ArgParseSettings()
| # example 1: minimal options/arguments, auto-generated help/version | |
| require("argparse.jl") | |
| import ArgParse.* | |
| function main(args) | |
| s = ArgParseSettings() | |
| s.prog = "argparse_example_1.jl" # program name (for usage & help screen) |
| dl = [-0.654981, -0.93716 , -0.459534, -0.0961306] | |
| d = [1.03823, 1.00984, 1.30874 , 1.23003 , 1.98585] | |
| v = [0.878788, 0.550649, 1.32675, -0.0301826, -0.48512] | |
| # lines 174-178 of test/lapack.jl | |
| Ts = Tridiagonal(dl,d,dl) | |
| Fs = full(Ts) | |
| invFsv = Fs\v | |
| Tldlt = ldlt(Ts) | |
| x = Tldlt\v |
| # example 6: commands & subtables | |
| require("argparse.jl") | |
| import ArgParse.* | |
| function main(args) | |
| s = ArgParseSettings("argparse_example_6.jl", | |
| "Example 6 for argparse.jl: " * | |
| "commands and their associated subtables.") |
| require("pkg") | |
| myresolve() = Pkg.cd_pkgdir() do | |
| have = (String=>ASCIIString)[] | |
| reqs = Metadata.parse_requires("REQUIRE") | |
| Git.each_submodule(false) do pkg, path, sha1 | |
| if pkg != "METADATA" | |
| have[pkg] = sha1 | |
| end | |
| end |
| abind 0.1.3 R | |
| abind 0.1.4 R 0.1.0 | |
| abind 0.1.5 R 0.1.0 | |
| abind 0.1.6 R 0.1.0 | |
| abind 0.1.7 R 0.3.0 | |
| AcceptanceSampling 1.2.0 R 0.1.0 1.0.0 | |
| AcceptanceSampling 1.3.0 R 0.1.0 1.0.0 | |
| aCGH.Spline 1.1.0 rJava | |
| aCGH.Spline 1.1.1 rJava | |
| aCGH.Spline 1.1.2 rJava 0.1.0 |
| b = BitArray(10_000_017); fill!(b, true) | |
| 2x4 DataFrame: | |
| Function Elapsed Relative Replications | |
| [1,] "oldfill" 0.703632 3.394 1000 | |
| [2,] "newfill" 0.207316 1.0 1000 | |
| b1 = randbool(10_000_117); b2 = randbool(10_000_017); copy!(b1, b2) | |
| 2x4 DataFrame: | |
| Function Elapsed Relative Replications | |
| [1,] "oldcopy" 0.834918 2.37655 1000 |
| # note: Enumerate2 and new_enumerate are `Enumerate` and `enumerate` in the pull request. | |
| dosomething(x::Float64, i::Int) = x+i | |
| function perf() | |
| n = 1_000_000 | |
| const a = rand(n) | |
| olden() = for (i, x) in enumerate(a) dosomething(x,i) end | |
| function oldeninline() |
| module NZipTest | |
| import Base.start, Base.next, Base.done, Base.length | |
| using Benchmark | |
| immutable NZip0 | |
| end | |
| immutable NZip1{I1} | |
| i1::I1 |
| # systematically compare return types of scalar vs array operations | |
| # (also div vs mod) | |
| # prints out only mismatching cases | |
| module ScalarArrayComp | |
| using DataFrames | |
| realtypes = [Bool, Uint8, Uint16, Uint32, Uint64, Uint128, |