Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Reduce (computer algebra system)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== File and package handling == REDUCE GUIs provide menu support for some or all of the file and package handling described below. === File handling === In order to develop non-trivial computations, it is convenient to store source code in a file and have REDUCE read it instead of interactive input. REDUCE input should be [[plain text]] (not [[Formatted text|rich text]] as produced by [[Word processor|word-processing]] applications). REDUCE filenames are arbitrary. The REDUCE source code uses the [[filename extension]] <code>.red</code> for the main source code and <code>.tst</code> for the test files, and for that reason REDUCE GUIs such as CSL REDUCE normally offer to input files with those extensions by default, but on platforms such as Microsoft Windows the extension <code>.txt</code> may be more convenient. It is recommended to end a REDUCE input file with the line ;end; as an end-of-file marker. This is something of a historical quirk but it avoids potential warning messages. Apart from that, an input file can contain whatever might be entered interactively into REDUCE. The command <code>in</code> ''file1''<code>,</code> ''file2''<code>,</code> ... inputs each of the named files in succession into REDUCE, essentially as if their contents had been entered interactively, after which REDUCE waits for further interactive input. If the separator used to terminate this command is a semi-colon (<code>;</code>) then the file content is [[Echo (computing)|echoed]] as output; if the separator is a dollar sign (<code>$</code>) then the file content is not echoed. REDUCE filenames can be either absolute or relative to the current directory; when using a REDUCE GUI absolute filenames are safer because it is not obvious what the current directory is! Filenames can be specified as either [[#Identifiers and strings|strings or identifiers]]; strings (in double quotes) are usually more convenient because otherwise filename elements such as directory separators and dots must be escaped with an exclamation mark (<code>!</code>). Note that the [[Microsoft Windows]] directory or folder separator, [[backslash]] (<code>\</code>), does not need to be doubled in REDUCE strings because backslash is not an escape character in REDUCE, but REDUCE on Microsoft Windows also accepts [[Slash (punctuation)|forward slash]] (<code>/</code>) as the directory separator. REDUCE output can be directed to a file instead of the interactive display by executing the command <code>out</code> ''file''<code>;</code> Output redirection can be terminated permanenty by executing the command <code>shut</code> ''file''<code>;</code> or temporarily by executing the command <code>out t;</code> There are similar mechanisms for directing a compiled version of the REDUCE input to a file and loading compiled code, which is the basis for building REDUCE and can be used to extend it. === Loading packages === REDUCE is composed of a number of packages; some are pre-loaded, some are auto-loaded when needed, and some must be explicitly loaded before they can be used. The command <code>load_package</code> ''package1''<code>,</code> ''package2''<code>,</code> ... loads each of the named packages in succession into REDUCE. Package names are ''not'' filenames; they are simple identifiers that do not need any exclamation marks, so they are normally input as identifiers, although they can be input as strings. A package consists of one or more files of compiled Lisp code, and the <code>load_package</code> command ensures that the right files are loaded in the right order. The precise filenames and locations depend on the version of Lisp on which REDUCE is built, but the package names are always the same.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)