The procedures described in these sections are supported by all implementations as part of the `*.init' files or by `require.scm'.
A vicinity is a descriptor for a place in the file system. Vicinities hide from the programmer the concepts of host, volume, directory, and version. Vicinities express only the concept of a file environment where a file name can be resolved to a file in a system independent manner. Vicinities can even be used on flat file systems (which have no directory structure) by having the vicinity express constraints on the file name.
All of these procedures are file-system dependent. Use of these vicinity procedures can make programs file-system independent.
These procedures are provided by all implementations. On most systems a vicinity is a string.
in-vicinity.
(pathname->vicinity "/usr/local/lib/scm/Link.scm")
=> "/usr/local/lib/scm/"
program-vicinity can return incorrect values if your program
escapes back into a load continuation.
home-vicinity
returns #f.
#f otherwise. Typical vicinity suffixes are `/',
`:', and `\',
slib:load,
slib:load-source, slib:load-compiled,
open-input-file, open-output-file, etc. The returned
filename is filename in vicinity. in-vicinity should
allow filename to override vicinity when filename is
an absolute pathname and vicinity is equal to the value of
(user-vicinity). The behavior of in-vicinity when
filename is absolute and vicinity is not equal to the value
of (user-vicinity) is unspecified. For most systems
in-vicinity can be string-append.
sub-vicinity will
return a pathname of the subdirectory name of
vicinity.
with-load-pathname evaluates thunk in a dynamic scope
where an internal variable is bound to path; the internal
variable is used for messages and program-vicinity.
with-load-pathname returns the value returned by thunk.
These constants and procedures describe characteristics of the Scheme and underlying operating system. They are provided by all implementations.
char->integer.
In implementations which do not support integers of practically unlimited size, most-positive-fixnum is the largest exact integer that may result from computing the length of a list, vector, or string.
unix, vms, macos, amiga, or
ms-dos.
(slib:report-version) => slib "3b1" on scm "5b1" on unix
(slib:report-version) followed by
almost all the information neccessary for submitting a problem report.
An unspecified value is returned.
(slib:report)
=>
slib "3b1" on scm "5b1" on unix
(implementation-vicinity) is "/usr/local/lib/scm/"
(library-vicinity) is "/usr/local/lib/slib/"
(scheme-file-suffix) is ".scm"
loaded slib:features :
trace alist qp sort
common-list-functions macro values getopt
compiled
implementation slib:features :
bignum complex real rational
inexact vicinity ed getenv
tmpnam abort transcript with-file
ieee-p1178 r4rs rev4-optional-procedures hash
object-hash delay eval dynamic-wind
multiarg-apply multiarg/and- logical defmacro
string-port source current-time record
rev3-procedures rev2-procedures sun-dl string-case
array dump char-ready? full-continuation
system
implementation *catalog* :
(i/o-extensions compiled "/usr/local/lib/scm/ioext.so")
...
These procedures are provided by all implementations.
#t if the specified file exists. Otherwise, returns
#f. If the underlying implementation does not support this
feature then #f is always returned.
#f is returned. Otherwise, #t is
returned.
open-file
returns a port depending on the symbol modes:
If an implementation does not distinguish between binary and non-binary files, then it must treat rb as r and wb as w.
If the file cannot be opened, either #f is returned or an error is signalled. For output, if a file with the given name already exists, the effect is unspecified.
close-file has no effect if the file has already been closed.
The value returned is unspecified.
call-with-open-ports.
call-with-open-ports calls proc with ports ....
If proc returns, then the ports are closed automatically and the
value yielded by the proc is returned. If proc does not
return, then the ports will not be closed automatically unless it is
possible to prove that the ports will never again be used for a read or
write operation.
(tmpnam) will return different
pathnames.
(current-output-port).
file-position returns the
current position of the character in port which will next be
read or written. If the implementation does not support
file-position, then #f is returned.
file-position sets the
current position in port which will next be read or written. If
successful, #f is returned; otherwise file-position
returns #f.
Returns the width of port, which defaults to
(current-output-port) if absent. If the width cannot be
determined 79 is returned.
Returns the height of port, which defaults to
(current-output-port) if absent. If the height cannot be
determined 24 is returned.
These procedures are provided by all implementations.
(slib:load-source "foo") will
load from file `foo.scm'.
If an implementation does not support compiled code then
slib:load will be identical to slib:load-source.
eval returns the value of obj evaluated in the current top
level environment. section Eval provides a more general evaluation
facility.
slib:eval-load procedure does not affect the values returned by
current-input-port and current-output-port.
#t, a success status is returned to
the system (if possible). If n is #f a failure is
returned to the system (if possible). If n is an integer, then
n is returned to the system (if possible). If the Scheme
session cannot exit, then an unspecified value is returned from
slib:exit.
If a browser is running, browse-url causes the browser to
display the page specified by string url and returns #t.
If the browser is not running, browse-url starts a browser
displaying the argument url. If the browser starts as a
background job, browse-url returns #t immediately; if
the browser starts as a foreground job, then browse-url returns
#t when the browser exits; otherwise (if no browser) it returns
#f.
These procedures are provided by all implementations.
Example:
(identity 3) => 3 (identity '(foo bar)) => (foo bar) (map identity lst) == (copy-list lst)
An exchanger is a procedure of one argument regulating mutually exclusive access to a resource. When a exchanger is called, its current content is returned, while being replaced by its argument in an atomic operation.
Returns a new exchanger with the argument obj as its initial content.
(define queue (make-exchanger (list a)))
A queue implemented as an exchanger holding a list can be protected from reentrant execution thus:
(define (pop queue)
(let ((lst #f))
(dynamic-wind
(lambda () (set! lst (queue #f)))
(lambda () (and lst (not (null? lst))
(let ((ret (car lst)))
(set! lst (cdr lst))
ret)))
(lambda () (and lst (queue lst))))))
(pop queue) => a
(pop queue) => #f
The following procedures were present in Scheme until R4RS (see section `Language changes' in Revised(4) Scheme). They are provided by all SLIB implementations.
#t.
#f.
(last-pair (cons 1 2))
=> (1 . 2)
(last-pair '(1 2))
=> (2)
== (cons 2 '())
Words changed since last version are marked in red by HITCH.