25. Environment

25.1 The External Environment#

Interface with the Programming Environment

25.1.1 Top level loop#

20.2.0 1The top level loop is the Common Lisp mechanism by which the user normally interacts with the Common Lisp system. This loop is sometimes referred to as the Lisp read-eval-print loop because it typically consists of an endless loop that reads an expression, evaluates it and prints the results.

20.2.0 2The top level loop is not completely specified; thus the user interface is implementation-defined. 20.2.0 3 Moon deleted the following sentence The top level loop traps all attempts to \term{throw} and recovers from them.The top level loop prints all values resulting from the evaluation of a form. 20.2.0 4The next figure lists variables that are maintained by the Lisp read-eval-print loop.

*+/-
**++//
***+++///

Figure 25–1. Variables maintained by the Read-Eval-Print Loop

25.1.2 Debugging Utilities#

The next figure shows defined names relating to debugging.

*debugger-hook*documentationstep
aproposdribbletime
apropos-listedtrace
breakinspectuntrace
describeinvoke-debugger

Figure 25–2. Defined names relating to debugging

25.1.3 Environment Inquiry#

Environment inquiry defined names provide information about the hardware and software configuration on which a Common Lisp program is being executed.

The next figure shows defined names relating to environment inquiry.

*features*machine-instanceshort-site-name
lisp-implementation-typemachine-typesoftware-type
lisp-implementation-versionmachine-versionsoftware-version
long-site-nameroom

Figure 25–3. Defined names relating to environment inquiry.

Removed identity! -kmp 3-Jan-91

25.1.4 Time#

25.4.1 1Time is represented in four different ways in Common Lisp: decoded time, universal time, internal time, and seconds. Decoded time and universal time are used primarily to represent calendar time, and are precise only to one second. Internal time is used primarily to represent measurements of computer time (such as run time) and is precise to some implementation-dependent fraction of a second called an internal time unit, as specified by internal-time-units-per-second. Actually, relative universal times aren't actually used for anything. But it didn't seem worth removing the mention, since it's a legit concept. -kmp 9-Sep-91 Moon wanted this shifted to say that Universal time is only absolute. \term{Decoded time} is used only for \term{absolute} \term{time} indications. \term{Universal time} and \term{internal time} formats are used for both \term{absolute} and \term{relative} \term{times}.An internal time can be used for either absolute and relative time measurements. Both a universal time and a decoded time can be used only for absolute time measurements. This may be gratuitous, but I just want to be clear.In the case of one function, sleep, time intervals are represented as a non-negative real number of seconds.

The next figure shows defined names relating to time.

decode-universal-timeget-internal-run-time
encode-universal-timeget-universal-time
get-decoded-timeinternal-time-units-per-second
get-internal-real-timesleep

Figure 25–4. Defined names involving Time.

25.1.4.1 Decoded Time#

25.4.1 2A decoded time is an ordered series of nine values that, taken together, represent a point in calendar time (ignoring leap seconds):

25.4.1 3

The next figure shows defined names relating to decoded time.

decode-universal-timeget-decoded-time

Figure 25–5. Defined names involving time in Decoded Time.

25.1.4.2 Universal Time#

25.4.1 13 \newtermidx{Universal time}{universal time} represents time as a single non-negative \term{integer}. For \term{relative} time purposes, this is a number of seconds. For absolute time, this is the number of seconds since midnight, January 1, 1900 GMT (ignoring \term{leap seconds}).Universal time is an absolute time represented as a single non-negative integer—the number of seconds since midnight, January 1, 1900 GMT (ignoring leap seconds). Thus the time 1 is 00:00:01 (that is, 12:00:01 a.m.) on January 1, 1900 GMT. Similarly, the time 2398291201 corresponds to time 00:00:01 on January 1, 1976 GMT. Recall that the year 1900 was not a leap year; for the purposes of Common Lisp, a year is a leap year if and only if its number is divisible by 4, except that years divisible by 100 are not leap years, except that years divisible by 400 are leap years. Therefore the year 2000 will be a leap year. Because universal time must be a non-negative integer, times before the base time of midnight, January 1, 1900 GMT cannot be processed by Common Lisp.

decode-universal-timeget-universal-time
encode-universal-time

Figure 25–6. Defined names involving time in Universal Time.

25.1.4.3 Internal Time#

25.4.1 14Internal time represents time as a single integer, in terms of an implementation-dependent unit called an internal time unit. Relative time is measured as a number of these units. Absolute time is relative to an arbitrary time base.

The next figure shows defined names related to internal time.

get-internal-real-timeinternal-time-units-per-second
get-internal-run-time

Figure 25–7. Defined names involving time in Internal Time.

25.1.4.4 Seconds#

One function, sleep, takes its argument as a non-negative real number of seconds. Informally, it may be useful to think of this as a relative universal time, but it differs in one important way: universal times are always non-negative integers, whereas the argument to sleep can be any kind of non-negative real, in order to allow for the possibility of fractional seconds.

sleep

Figure 25–8. Defined names involving time in Seconds.

Dictionary