Maxima – 81 – Files di input e output – funzioni e variabili – 1

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.250.

appendfile (filename)
Appends a console transcript to filename. appendfile is the same as writefile, except that the transcript file, if it exists, is always appended.

closefile closes the transcript file opened by appendfile or writefile.

(%i1) 6 * 7;
(%o1)                                 42
(%i2) appendfile("prova");

/* Starts dribbling to prova (2018/10/12, 07:40:09).*/
(%o2)                                done
(%i3) 8 * 9;
(%o3)                                 72
(%i4) closefile();

/*Finished dribbling to prova.*/
(%o4)                                done

ecco il file prova

/* Starts dribbling to prova (2018/10/12, 07:40:09).*/
(%o2)                                done
8 * 9;(%o3)                                 72
/*Finished dribbling to prova.*/

batch (filename)
batch (filename, option)
batch(filename) reads Maxima expressions from filename and evaluates them. batch searches for filename in the list file_search_maxima. See also file_search.

batch(filename, demo) is like demo(filename). In this case batch searches for filename in the list file_search_demo. See demo.

batch(filename, test) is like run_testsuite with the option display_all=true. For this case batch searches filename in the list file_search_maxima and not in the list file_search_tests like run_testsuite. Furthermore, run_testsuite runs tests which are in the list testsuite_files. With batch it is possible to run any file in a test mode, which can be found in the list file_search_maxima. This is useful, when writing a test file.

filename comprises a sequence of Maxima expressions, each terminated with ; or $. The special variable % and the function %th refer to previous results within the file.

The file may include :lisp constructs. Spaces, tabs, and newlines in the file are ignored. A suitable input file may be created by a text editor or by the stringout function.

batch reads each input expression from filename, displays the input to the console, computes the corresponding output expression, and displays the output expression.

Input labels are assigned to the input expressions and output labels are assigned to the output expressions. batch evaluates every input expression in the file unless there is an error. If user input is requested (by asksign or askinteger, for example) batch pauses to collect the requisite input and then continue.

It may be possible to halt batch by typing control-C at the console. The effect of control-C depends on the underlying Lisp implementation.

batch has several uses, such as to provide a reservoir for working command lines, to give error-free demonstrations, or to help organize one’s thinking in solving complex problems.

batch evaluates its argument. batch returns the path of filename as a string, when called with no second argument or with the option demo. When called with the option test, the return value is a an empty list [] or a list with filename and the numbers of the tests which have failed.

See also load, batchload, and demo.

batchload (filename)
Reads Maxima expressions from filename and evaluates them, without displaying the input or output expressions and without assigning labels to output expressions. Printed output (such as produced by print or describe)) is displayed, however.

The special variable % and the function %th refer to previous results from the interactive interpreter, not results within the file. The file cannot include :lisp constructs.

batchload returns the path of filename, as a string. batchload evaluates its argument.

See also batch, and load.

closefile ()
Closes the transcript file opened by writefile or appendfile.

Default value: false.

file_output_append governs whether file output functions append or truncate their output file. When file_output_append is true, such functions append to their output file. Otherwise, the output file is truncated.

save, stringout, and with_stdout respect file_output_append. Other functions which write output files do not respect file_output_append. In particular, plotting and translation functions always truncate their output file, and tex and appendfile always append.

filename_merge (path, filename)
Constructs a modified path from path and filename. If the final component of path is of the form ###.something, the component is replaced with filename.something. Otherwise, the final component is simply replaced by filename.

The result is a Lisp pathname object.

file_search (filename)
file_search (filename, pathlist)
file_search searches for the file filename and returns the path to the file (as a string) if it can be found; otherwise file_search returns false. file_search (filename) searches in the default search directories, which are specified by the file_search_maxima, file_search_lisp, and file_search_demo variables.

file_search first checks if the actual name passed exists, before attempting to match it to “wildcard” file search patterns. See file_search_maxima concerning file search patterns.

The argument filename can be a path and file name, or just a file name, or, if a file search directory includes a file search pattern, just the base of the file name (without an extension). For example,
file_search ("/home/wfs/special/zeta.mac");
file_search ("zeta.mac");
file_search ("zeta");
all find the same file, assuming the file exists and /home/wfs/special/###.mac is in file_search_maxima.

file_search (filename, pathlist) searches only in the directories specified by pathlist, which is a list of strings. The argument pathlist supersedes the default search directories, so if the path list is given, file_search searches only the ones specified, and not any of the default search directories. Even if there is only one directory in pathlist, it must still be given as a one-element list.

The user may modify the default search directories. See file_search_maxima.

file_search is invoked by load with file_search_maxima and file_search_lisp as the search directories.

Posta un commento o usa questo indirizzo per il trackback.



Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di

Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.

%d blogger hanno fatto clic su Mi Piace per questo: