This commit is contained in:
dzaima 2022-04-07 19:43:49 +03:00
parent 1948360a6c
commit 7adb06a43d
2 changed files with 7 additions and 0 deletions

View File

@ -6,6 +6,10 @@ These are commands usable from a CBQN REPL that, for one reason or another, aren
Execute the contents of the file as if it were REPL input (but allowing multiline definitions). Not a system function because modifying the list of global variables during execution is not allowed. Execute the contents of the file as if it were REPL input (but allowing multiline definitions). Not a system function because modifying the list of global variables during execution is not allowed.
## `)r expr`
Execute the expression, but don't print its result.
## `)t expr` / `)time expr` / `)t:n expr` / `)time:n expr` ## `)t expr` / `)time expr` / `)t:n expr` / `)time:n expr`
Time the argument expression. `n` specifies the number of times to repeat. Exists to allow not escaping quotes and less overhead for timing very fast & small expressions. Time the argument expression. `n` specifies the number of times to repeat. Exists to allow not escaping quotes and less overhead for timing very fast & small expressions.

View File

@ -53,6 +53,9 @@ void cbqn_runLine0(char* ln, i64 read) {
B path = fromUTF8l(cmdE); B path = fromUTF8l(cmdE);
code = path_chars(path); code = path_chars(path);
output = 0; output = 0;
} else if (isCmd(cmdS, &cmdE, "r ")) {
code = fromUTF8l(cmdE);
output = 0;
} else if (isCmd(cmdS, &cmdE, "t ") || isCmd(cmdS, &cmdE, "time ")) { } else if (isCmd(cmdS, &cmdE, "t ") || isCmd(cmdS, &cmdE, "time ")) {
code = fromUTF8l(cmdE); code = fromUTF8l(cmdE);
time = -1; time = -1;