Learn Shen
Community Wiki
OS Kernel
OS Library
Shen Professional


The File Package

The Standard Extension contains a suite for reading and appending large files. The file suite in SP allows the manipulation of files whose size is only limited by the availability of disk space (a naive algorithm fails to do this). The system has been tested with files of 680Mb.


append-files : (list string) --> string --> string

Appends the listed files in order to form a new file given by the second argument. The name of the new file is returned as a result.

append-to-file : (A --> string --> symbol --> symbol --> string)

Given arguments a, f, b, t appends a to the file f. If b is
backup, then a file f.backup of the original file is created. If b is nobackup, no such file is created, If t is top, then a is appended to the top of the file and if t is bottom to the bottom. The symbol values may be unspecified in which case they default to top and nobackup.

copy-file : string --> string --> string

Copies an existing file to one of a new name. Returns the name of the new file.

delete-file : string --> string

Deletes a file returning its name.

errout : (A --> A --> A)

Given arguments a and b, evaluates a and returns the result if no error is raised. If an error is raised, then the error message is appended to
err.shen and b is evaluated as a default.

file-size : (string --> number)

Returns the byte size of the file.

reopen : (string --> (stream out))

Reopens output to a file preserving the original contents. The output stream to the file is returned as a result.

write-file-as-bytelist : string --> (list number) --> string

Writes to a file the list of bytes contained in the list argument and returns the file name.

x->bytes : (A --> (list number))

Returns the list of bytes representing the argument.