Embeddable Common Lisp 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 Copyright (C) 2015 Daniel Kochmanski 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. Top level in: #<process TOP-LEVEL>. >
When invoked, Embeddable Common Lisp will print the banner and initialize the system.
The number in the Embeddable Common Lisp banner identifies the revision of
Embeddable Common Lisp. 0.0e
is the value of the function
lisp-implementation-version
.
Unless user specifies --norc
flag when invoking the Embeddable Common Lisp, it
will look for the initialization files ~/.ecl and
~/.eclrc. If he wants to load his own file from the current
directory, then he should pass the file path to the --load
parameter:
% ecl --norc --load init.lisp
After the initialization, Embeddable Common Lisp enters the top-level loop and
prints the prompt ‘>
’.
Type :h for Help. Top level. >
The prompt indicates that Embeddable Common Lisp 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
with the package name.
> (in-package "CL") #<"COMMON-LISP" package> COMMON-LISP> (in-package "SYSTEM") #<"SI" package> SI>
To exit from Embeddable Common Lisp, call the function ext:quit
.
> (quit) %
Alternatively, you may type ^D
on UNIX-like operating systems,
i.e. press the key D
while pressing down the control key (Ctrl),
on Windows, you should use ^Z
followed by a return.
> ^D %
The top-level loop of Embeddable Common Lisp 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 signaled, control will enter the break loop.
> (defun foo (x) (bar x)) foo > (defun bar (y) (bee y y)) bar > (foo 'lish) Condition of type: UNDEFINED-FUNCTION The function BEE is undefined. Available restarts: 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL. Broken at FOO. In: #<process TOP-LEVEL>. >>
‘>>
’ 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 cl-user
package.
To go back to the top-level loop, type :q
>>:q Top level in: #<process TOP-LEVEL>. >
If more restarts are present, user may invoke them with by typing
:rN
, where N is the restart number. For instance to pick
the restart number two, type :r2
.
See [The break loop] 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 Condition of type: INTERACTIVE-INTERRUPT Console interrupt. Available restarts: 1. (CONTINUE) CONTINUE 2. (RESTART-TOPLEVEL) Go back to Top-Level REPL. Broken at FOO. In: #<process TOP-LEVEL>. >>