argv
result = argv()
Input: no input · Output: result
What it is
Takes no arguments.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = argv() | no input | result string | Returns a list of strings: the command-line arguments given after a literal -- in the invocation (e.g. qu run analyse.qu -- data.csv 1000 gives ("data.csv", "1000")). |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
args = argv()
print(length(args)) # 2 -- "data.csv" and "1000"
print(args) # ("data.csv", "1000")
level = getenv("QU_LOG") ?? "info"
print(level)
0 () info
from file-io
How it works
--- Talking to the outside world ------------------------- Without these a .qu file cannot be told anything: not an input path, not a cutoff frequency, not a run label, and it cannot stamp a result with a date (timer/tic/toc are monotonic, so they measure durations and know nothing about when). That ruled out cron jobs, parameter sweeps, Makefile steps -- every use where something else drives Qu. The 38 ms cold start makes that especially galling: Qu is fast enough to be the thing you call in a loop, and had no way to hear what the loop wanted to say. argv() -- everything after -- on the command line: qu run analyse.qu -- data.csv 1000 A list of strings, empty when nothing was passed, so a script can branch on length(argv()) without a guard.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.