Miscellaneous¶
-
Time(expr)¶ measure the time taken by a function
- Param expr
any expression
The function
Time()evaluates the expressionexprand prints the time in seconds needed for the evaluation. The time is printed to the current output stream. The built-in functionGetTime()is used for timing.The result is the “user time” as reported by the OS, not the real (“wall clock”) time. Therefore, any CPU-intensive processes running alongside yacas will not significantly affect the result of
Time().- Example
In> Time(N(MathLog(1000),40)) 0.34 seconds taken Out> 6.9077552789821370520539743640530926228033;
See also
-
SystemCall(str)¶ pass a command to the shell
The command contained in the string
stris executed by the underlying operating system. The return value ofSystemCall()isTrueorFalseaccording to the exit code of the command.The
SystemCall()function is not allowed in the body of theSecure()command.In a UNIX environment, the command
SystemCall("ls")would print the contents of the current directory:In> SystemCall("ls") AUTHORS COPYING ChangeLog ... (truncated to save space) Out> True;The standard UNIX command
testreturns success or failure depending on conditions. For example, the following command will check if a directory exists:In> SystemCall("test -d scripts/") Out> True;Check that a file exists:
In> SystemCall("test -f COPYING") Out> True; In> SystemCall("test -f nosuchfile.txt") Out> False;See also