Open fkrauer opened 2 years ago
@fkrauer I'm not experienced with metaprogramming, but that seems like a solution
...
moo = float.(eval(Meta.parse(args["moo"])))
...
foo = float.(eval(Meta.parse(args["foo"])))
% j testparse.jl --foo="[1.0, 2.0, 3.0]" --moo="[4:4:12;]"
[4.0, 8.0, 12.0]
[1.0, 2.0, 3.0]
[4.0, 16.0, 36.0]
Hi I have a script that takes some arguments, some of which are numeric vectors. Since the arguments passed to the command line need to be a string (
"[0.1, 0.5]"
), I am looking for ways to convert the string to a vector within the script. I found a solution if the string is a verbatim of julia syntax, but it does not work for something like[1.0:10.0:100.0;]
. How can I parse such as vector? Here is a MWE (testparse.jl
):This works:
But this doesn't work: