Splice

Splice["file"]
splices Wolfram Language output into an external file. It takes text enclosed between and in the file, evaluates the text as Wolfram Language input, and replaces the text with the resulting Wolfram Language output.

Details and OptionsDetails and Options

  • Splice["infile","outfile"] processes text from the file infile, and writes output into outfile.
  • Splice["file"] takes files with names of the form name.mx and writes output in files with names name.x.
  • Text in the input file not enclosed between and is copied without change to the output file.
  • The default format for Wolfram Language output is determined by the extension of the input file name:
  • name.mcCForm
    name.mfFortranForm
    name.mtexTeXForm
  • The following options for Splice can be used:
  • Delimiters{"<*","*>"}delimiters to search for
    FormatTypeAutomaticdefault format for Wolfram Language output
    PageWidth78number of character widths per output line
  • You can use pipes instead of files for input and output to Splice.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Create a file with an expression:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Read the file:

Splice Wolfram Language output into the file:

In[5]:=
Click for copyable input
Out[5]=

Read the output file:

Introduced in 1988
(1.0)