Previous: Building ECL, Up: Introduction


1.4 Entering and leaving ECL

ECL is invoked by the command ecl.

% ecl
ECL (Embeddable Common-Lisp) 0.0e
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
        ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Top level.
>

When invoked, ECL will print the banner and initialize the system. The date in the ECL banner identifies the revision of ECL. Version (0.8) 05/14/1993 is the value of the function lisp-implementation-version.

If there exists a file named init.lsp in the current working directory, ECL successively evaluates the forms in the file, immediately after the system initialization. The user may set up his or her own ECL environment (e.g., the memory configuration) with init.lsp.

After the initialization, ECL enters the top-level loop and prints the prompt `>'.

Type :h for Help.  Top level.
>

The prompt indicates that ECL is now ready to receive a form from the terminal and to evaluate it.

Usually, the current package (i.e., the value of *package*) is the user package, and the prompt appears as above. If, however, the current package is other than the user package, then the prompt will be prefixed by the package name.

> (in-package 'cl)
#<"COMMON-LISP" package>
COMMON-LISP> (in-package 'system)
#<"SYSTEM" package>
SYSTEM>

To exit from ECL, call the function quit.

>(quit)
Bye.
%

Alternatively, you may type ^D, i.e. press the key <D> while pressing down the control key (<Ctrl>).

>^DBye.
%

You can disable ^D as the exit command by setting to T the following variable:

— System: *ignore-eof-on-terminal-io*

This variable controls whether an end of file character (normally ^D) should terminate the session. The default value is ().

The top-level loop of ECL is almost the same as that defined in Section 20.2 of [see Steele:84]. Since the input from the terminal is in line mode, each top-level form should be followed by a newline. If more than one value is returned by the evaluation of the top-level form, the values will be printed successively. If no value is returned, then nothing will be printed.

>(values 1 2)
1
2
>(values)

>

When an error is signalled, control will enter the break loop.

>(defun foo (x) (bar x))
foo

>(defun bar (y) (bee y y))
bar

>(foo 'lish)
Error: The function BEE is undefined.
Error signalled by BAR.

Broken at BAR.
>>

`>>' in the last line is the prompt of the break loop. Like in the top-level loop, the prompt will be prefixed by the current package name, if the current package is other than the user package.

To go back to the top-level loop, type :q

>>:q

Top level.
>

See Section 5.4 for the details of the break loop.

The terminal interrupt (usually caused by typing ^C (Control-C)) is a kind of error. It breaks the running program and calls the break level loop.

Example:

>(defun foo () (do () (nil)))
foo

>(foo)
^C
Correctable error: Console interrupt.
Signalled by DO.

Broken at FOO.
>>