redStart | R Documentation |
Starts a REDUCE session using a pipe connection sending the output (log) to a temporary file.
redStart(dialect = "csl", dirpath, options, echo=FALSE)
dialect |
character. The version of lisp with which the REDUCE executable was
built. Allowed values are |
dirpath |
character. Path to a directory containing the REDUCE executables. Optional, see details below. |
options |
character. Options for the |
echo |
boolean. Should the ECHO switch be turned on. Default is FALSE to match the REDUCE default. |
redcas
finds the REDUCE executables in two different ways. The
first is the explicit specification of the path using the
dirpath
argument passed to the redStart
function. If this
does not contain the REDUCE executable, redStart
stops executing
on the assumption that a specific version was intended.
The second method is used if dirpath
is not specified. This
determines the path at package load time by searching the following three
locations in turn until the executable is found:
the environment variable REDUCE_EXEC exists and contains the path to a directory containing an executable;
the R option reduce_exec
exists and contains the path
to a directory containing the executable;
the REDUCE executable is found in a directory named in the environment variable PATH.
This approach provides the flexibility to have a default version while being able to call different versions explicitly.
While it is possible to start a second REDUCE session without closing the first, garbage collection closes its connection. A future release will fix this issue.
redStart
carries out the following actions:
creates the REDUCE session using a pipe connection and sending the REDUCE output to a temporary file (in REDUCE terminology referred to as a log);
registers the session, acquiring a session identifier
calls redExec
to load the REDUCE functions which
are part of the package and to set the ECHO switch if requested.
returns the session identifier.
The session identifier which is an integer >0 if the session started
successfully. If the session could not be started, redStart
terminates using stop
. If no REDUCE executable was found returns FALSE.
martin gregory
showSessions
to list active sessions and
redClose
for closing a session.
## Open a CSL session:
id1 <- redStart()
## can only run code if session was successfully started
if (is.numeric(id1)) {
## show session details:
print(showSessions())
## close session:
redClose(id1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.