7  Common Modules

The following modules are provided under the (common ...) hierarchy, which is reserved for modules distributed with Common-Scheme. The rationale for including something as a Common-Scheme module is either that it cannot be supported portably or is a simple and common feature.

7.1  combinator

Some basic higher-order functions. Although these could easily be defined portably, many Schemes already have some or all of these, and they are useful for discussing the behavior of other procedures.

7.2  env

Access to current system environment, machine and user information. Slightly POSIX-centric - pretend the descriptions are generalizated to arbitrary systems.

7.3  file

Basic file-system access. Notably lacking at the moment are access to modes and extensive permissions.

7.4  io

Some basic input/output utilities.

7.5  pathname

A library to manipulate pathnames as strings. Many Schemes provide something similar, and most have bugs. We provide a complete and thoroughly tested implementation.

These work the same on all platforms using the Unix-style slash ``/'' delimiter with dot ``.'' and double-dot ``..'' for the current and parent directories respectively. This is fairly universally accepted on systems these days and moreover is the pathname syntax for URLs. The procedures however, should not be used directly on URLs but only on the pathname components thereof - a URL library will likely be included in Common-Scheme soon.

An alternative strategy to manipulating pathname strings is to use records with fields for each pathname component, which depending on the application in question may be more or less efficient. Since at the operating system and web application level we must convert to a string anyway we start with the string-based API and leave records for future consideration.

With the exception of current-directory and set-current-directory! all procedures are prefixed with ``path-'' for consistency. This seems no less descriptive than a ``pathname-'' prefix while being shorter. It also avoids the confusion of whether the extra hyphen should be used in prefixes such as ``path-name-'' and ``file-name-''.

With the exception of [set-]current-directory[!] and path-expand none of these procedures access the filesystem. The library is intended to manipulate arbitrary paths which may be referring to another system or URL, not necessarily a file on the current system.

7.6  process

Handling subprocesses.

7.7  regex

Standardized regex API. Note the name of the module is the least common prefix of the common abbreviated plurals of regular expression: ``regexes,'' ``regexps,'' and ``regexen.''

7.8  string-cursor

An alternate interface to strings, friendly to non-array-based string implementations such as ropes and variable-width encodings, just as efficient and yet more flexible because the same interface allows working with ``character'' units of different conceptual levels.

7.9  tcp

Simplest TCP interface I could come up with.