Function Entry: CLAL-COMMON-LISP

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: CLAL-COMMON-LISP

Name

clal-common-lisp

Class

clautolisp Extension Function

Syntax

(clal-common-lisp)
(clal-common-lisp form)

Arguments and Values

  • form — optional. A string is READ as one Common Lisp form and evaluated; any other AutoLISP value is structurally converted to a CL form and evaluated. Omitted: run an interactive CL REPL.

Description

Drop from AutoLISP into Common Lisp (the cl-debugging facility). With no argument it runs an interactive CL REPL in COMMON-LISP-USER (leave it with (clal-back [value])). With a string it READs and EVALs one CL form; with any other value it converts the AutoLISP object to a CL form and EVALs it. The primary value is converted back to an AutoLISP object. This builtin is only bound to the AutoLISP name CLAL-COMMON-LISP when the CLAUTOLISPDROP sysvar gates it on — writing a non-zero CLAUTOLISPDROP shadows the symbol with this builtin (saving any user binding), and 0 restores the previous binding.

Return Values

The primary CL value converted to an AutoLISP object (integers in range pass through, floats become double-floats, strings wrap, keywords/symbols intern as AutoLISP symbols, conses convert recursively). nil from an empty REPL / clal-back with no value.

Side Effects

Evaluates arbitrary Common Lisp; the REPL reads from *standard-input* and prints to *standard-output*.

Affected By

  • CLAUTOLISPDROP (sysvar) — gates whether the name is bound.
  • *clal-on-error* (and its CL twin common-lisp-user::*clal-on-error*) — the unhandled-error policy: :debug (default) native CL debugger, :error a catchable AutoLISP error, :ignore returns nil, any other value is returned.
  • The current CL *package* / *readtable* (symbol re-reading).

Exceptional Situations

On an unhandled CL error (including a result that cannot be converted), behaviour follows *clal-on-error*. An out-of-range integer or a circular structure cannot be converted back and raises a CL error.

Examples

(clal-common-lisp "(+ 1 2)")
=> 3
(clal-common-lisp)     ; interactive CL REPL; (clal-back) to return

Availability

  • clautolisp: documented (this entry); implemented since an earlier clautolisp release.
  • AutoCAD: NOT present.
  • BricsCAD: NOT present.

Source Notes

  • clautolisp-only extension. Companions in COMMON-LISP-USER: clal-back (leave the dropped REPL) and clal-common-lisp; the gate sysvar is CLAUTOLISPDROP. See the cl-debugging issue.