Appendix A. Frequently Asked Questions (With Answers) about CLISP

Abstract

This is a list of frequently asked questions about CLISP on the CLISP mailing lists and the USENET newsgroup comp.lang.lisp. All the legitimate technical question are addressed in the CLISP documentation (CLISP impnotes, clisp(1), clisp-link(1)), and for such questions this list provides a link into the docs. The frequently asked political questions are answered here in full detail (meaning that no further explanations of the issues could be provided).

Please submit more questions (and answers!) to clisp-list.

FAQ

A.1. Meta Information
A.1.1. Miscellaneous
A.1.1.1. What is “FAQ fine”?
A.1.1.2. The official CLISP documentation sucks - is anything better available?
A.1.1.3. License - why GNU GPL?
A.1.1.4. What about [ANSI CL standard] compliance?
A.1.1.5. How do I ask for help?
A.1.1.6. Which mailing lists should I subscribe to?
A.1.1.7. Why is my mail to a mailing list rejected?
A.1.1.8. How do I report bugs?
A.1.1.9. How do I help?
A.1.1.10. How do I debug CLISP?
A.1.2. Logo
A.1.2.1. Why is CLISP using menorah as the logo?
A.1.2.2. Shouldn't the logo be changed now due to the current political developments in the Middle East?
A.1.2.3. Aren't there other political issues of concern?
A.1.2.4. Aren't you afraid of losing some users who are offended by the logo?
A.1.2.5. Using software to promote a political agenda is unprofessional!
A.2. Running CLISP
A.2.1. Why are floats printed in binary?
A.2.2. Where is the IDE?
A.2.3. What are the command line arguments?
A.2.4. How do I get out of the debugger?
A.2.5. What CLISP extensions are available?
A.2.6. Where is the init (“RC”) file on my platform?
A.2.7. Where are the modules with which I built CLISP?
A.2.8. How do I create a GUI for my CLISP program?
A.3. Application Delivery
A.3.1. How do I create an executable file with all my code in it?
A.3.2. When I deliver my application with CLISP, does it have to be covered by the GNU GPL?
A.4. Troubles
A.4.1. Where is the binary distribution for my platform?
A.4.2. But a previous release had a binary distribution for my platform, why does not the current one?
A.4.3. Why does not CLISP build on my platform?
A.4.4. Why is the --with-libsigsegv-prefix option ignored by the configure script on my 64-bit machine?
A.4.5. What do charset errors mean?
A.4.6. What does this message mean: “Display all 1259 possibilities? (y or n)”
A.4.7. Why does not command line editing work?
A.4.8. How do I avoid stack overflow?
A.4.9. Why does my program return different values on each invocation?
A.4.10. Is floating point arithmetic broken?
A.4.11. Is RANDOM broken?
A.4.12. Why is an extra line break inserted by the pretty printer?
A.4.13. How do I disable this annoying warning?
A.4.14. Why does DEFVAR affect previously defined lexical closures?
A.4.15. The error message is not helpful!
A.4.16. Why is the function FOO broken?!

A.1. Meta Information

A.1.1. Miscellaneous
A.1.1.1. What is “FAQ fine”?
A.1.1.2. The official CLISP documentation sucks - is anything better available?
A.1.1.3. License - why GNU GPL?
A.1.1.4. What about [ANSI CL standard] compliance?
A.1.1.5. How do I ask for help?
A.1.1.6. Which mailing lists should I subscribe to?
A.1.1.7. Why is my mail to a mailing list rejected?
A.1.1.8. How do I report bugs?
A.1.1.9. How do I help?
A.1.1.10. How do I debug CLISP?
A.1.2. Logo
A.1.2.1. Why is CLISP using menorah as the logo?
A.1.2.2. Shouldn't the logo be changed now due to the current political developments in the Middle East?
A.1.2.3. Aren't there other political issues of concern?
A.1.2.4. Aren't you afraid of losing some users who are offended by the logo?
A.1.2.5. Using software to promote a political agenda is unprofessional!

A.1.1. Miscellaneous

A.1.1.1. What is “FAQ fine”?
A.1.1.2. The official CLISP documentation sucks - is anything better available?
A.1.1.3. License - why GNU GPL?
A.1.1.4. What about [ANSI CL standard] compliance?
A.1.1.5. How do I ask for help?
A.1.1.6. Which mailing lists should I subscribe to?
A.1.1.7. Why is my mail to a mailing list rejected?
A.1.1.8. How do I report bugs?
A.1.1.9. How do I help?
A.1.1.10. How do I debug CLISP?

A.1.1.1.

What is FAQ fine?

We levy a fine of 10 zorkmids for asking a question that is answered with a link to this FAQ document. We further levy a fine of 1 zorkmid for asking a question that is answered with a link to the CLISP manual. The fines are payable to the person who answered the questions. The definition of a zorkmid is left to the sole discretion of the payer.

This should not discourage you from asking questions, but rather encourage you to read the manual and answer questions from other users.

A.1.1.2.

The official CLISP documentation sucks - is anything better available?

As with all generic complaints, the answer to this one is PTC.

Additionally, the nightly builds of the CLISP implementation notes documenting the current CVS HEAD are available at http://clisp.podval.org/impnotes/. It contains both the documentation for the new features and the general improvements in the documentation.

A.1.1.3.

License - why GNU GPL?

Because CLISP uses GNU readline.

Note that this does not necessarily prevent you from distributing your proprietary products based on CLISP. See Note in COPYRIGHT and Q: A.3.2.

A.1.1.4.

What about [ANSI CL standard] compliance?

CLISP purports to conform to the [ANSI CL standard] specification, so all deviations in

$ clisp -ansi

from the [ANSI CL standard] are bugs and are not (yet) fixed only due to lack of resources.

On the other hand, some decisions made by the ANSI X3J13 committee were not as justified from the technical point of view as were most of them, and some of those questionable decisions were made after the alternative behavior has already been implemented in CLISP. The CLISP developers took pains to modify CLISP to unconditionally comply with the [ANSI CL standard] specification in all cases except for a handful of situations where they believed that the committee had made a mistake, in which cases the committee behavior is still optionally available.

CLISP does not start in the ansi mode by default for historical reasons and this is not about to change. Dumping an image or passing a command line argument are easy enough.

A.1.1.5.

How do I ask for help?

CLISP

Type help and hit Enter.

Human

Politely - please refer to Netiquette.

If you have a question about CLISP, you have the following options (listed in the order of decreasing audience size):

USENET group comp.lang.lisp
This is the right place to ask all general Lisp questions, such as "how do I access a character in a string?"
CLISP User Mailing List clisp-list
AKA http://news.gmane.org/gmane.lisp.clisp.general

This is the right place to ask user-level CLISP-specific questions, such as "how do I save my CLISP memory image?".

See also Q: A.1.1.8.

CLISP Developer Mailing List clisp-devel
AKA http://news.gmane.org/gmane.lisp.clisp.devel
This is the right place to discuss CLISP internals, problems with the current development sources, submit patches, offer help.
Individual CLISP developers

This is never the right thing to do, unless you want to hire this developer to do CLISP consulting (commercial support, custom enhancements etc). This is actually for your own benefit: the CLISP developers are very busy, they might get weeks to answer your question, and some other user may be able to help you in the meantine; as well as for the benefit of the other CLISP users, since the mailing lists are publicly archived (you are encouraged to search them before asking).

Please do not copy your messages to the individual developers.

Mailing lists are member-only

To avoid spam, we require that you subscribe before you can post to a mailing list. Alternatively, you can post to the CLISP web forum and your message will be forwarded to the clisp-list mailing list. If you read a list on Gmane and do not want to receive it also by e-mail, you can subscribe to it using the aforementioned web interface and then disable mail delivery.

A.1.1.6.

Which mailing lists should I subscribe to?

Cross-posting in the CLISP mailing lists is very actively discouraged and is virtually non-existent, thus you can subscribe to all mailing lists that are relevant to you without getting duplicate messages:

clisp-announce
Extremely low-level moderated list, you should definitely subscribe to this list if you have any interest in Common Lisp or CLISP whatsoever.
clisp-list
Subscribe to this list of you use CLISP and want to ask (and answer!) questions. If you subscribe to this list, you probably want to subscribe to clisp-announce too.
clisp-devel
Subscribe to this list if you want to influence CLISP developments; CVS commit notes go here (as a daily digest). If you subscribe to this list, you probably want to subscribe to clisp-list and clisp-announce too.

A.1.1.7.

Why is my mail to a mailing list rejected?

CLISP mailing lists get a lot of spam, so the maintainers have to take care to protect the users. If you get a note that your message is held for moderator's approval, you can safely assume that it went to /dev/null and try again, noting the following:

clisp-announce
do not mail here without a prior discussion on clisp-devel or clisp-list
clisp-devel
subscriber-only, you must post from a subscribed address, no exceptions (see above)
clisp-list

used to be the only open list (it is closed now), so it is filtered especially aggressively:

  • no MIME mail (no HTML formatting, no attachments - send the URL instead)
  • the list address must be in CC or TO, not BCC.
  • do not mention virgin, penis or viagra in the Subject line.

If you do not like this policy, please volunteer to maintain the mailing lists - you will be required to go through all the held for moderator's approval mail and approve/discard as appropriate at least twice a day.

A.1.1.8.

How do I report bugs?

Patiently!

A.1.1.9.

How do I help?

Please read Chapter 36, Extending CLISP Core and submit your patch, together with a src/ChangeLog entry (see other entries there for inspiration), to clisp-devel.

See src/CodingStyle for the style one should follow.

If your patch is more than just a few lines, it is much preferred that you make your patch available on the web and send the link to the list.

The patch must be against the CVS head (reasonably recent).

A.1.1.10.

How do I debug CLISP?

Configuring for debugging. Passing --with-debug to the top-level configure script does not just replace -O with -g in the gcc invocation, it also disables some optimizations (registers, assembly, generational garbage-collector) and enables some printf calls (mostly before error messages caused by system calls). This means that some bugs might be exhibited by the normal build but not by the --with-debug one (and vice versa). If that is the case, please configure normally but edit the Makefile and replace the gcc optimization options (-O et al) with -g before running make.

Debugging the core. 

$ ./configure --with-debug --cbc build-g
$ cd build-g
$ gdb lisp.run ;; or lisp.exe on Win32 and Cygwin
(gdb) boot
(gdb) run

Debugging module foo

$ ./configure --with-debug --with-module=foo --cbc build-g
$ cd build-g
$ gdb full/lisp.run ;; or lisp.exe on Win32 and Cygwin
(gdb) full
(gdb) run

When debugging a base module, use base instead of full and boot above.

The impact of generational garbage-collector. If your CLISP was built with generational garbage-collector, you will see plenty of spurious segfaults (that's how the generational garbage-collector works). At the end of src/.gdbinit you will find the following suggested gdb commands:

handle SIGSEGV noprint nostop
break sigsegv_handler_failed

which will stop execution on a dangerous segfault. You can find out whether this is needed by examining the output of the following command:

$ clisp --version | grep GENERATIONAL_GC

Useful commands. You are encouraged to make use of commands defined in src/.gdbinit, such as

bootrun_mod_testxout
baserun_all_testszout
fullrun_ansi_testszbacktrace
run_testrun_ansi_tests_compiled 

and others; help command in gdb will tell you what command does.

Macros. CLISP makes heavy use of cpp macros (e.g., pushSTACK), which can complicate debugging in gdb. The macros are defined in src/lispbibl.d, but the maze of conditionals may be hard to navigate. If you are using gcc, you can do make lispbibl.h and then examine the definitions in the generated lispbibl.h. See also bottom of src/spvw_debug.d.

Binary Search in Time. When you encounter an regression error (i.e., something worked in a previous version of CLISP, but does not work in the current version) which we cannot reproduce, we will often ask you to figure out which specific CVS commit introduced it. The way to figure that out is to use the binary search in time, specifically:

  1. Write a script test-clisp, which tests for the bug given a path to the CLISP executable.
  2. Select dates good-date and bad-date such that the bug is present at bad-date (e.g., set it to the current date) and not present at good-date.
  3. Let date m be the midpoint between good-date and bad-date. Do:

    $ cvs co -D m clisp
    $ cd clisp; ./configure --cbc build; cd ..;
    $ if test-clisp ./clisp/build/clisp; then rm -rf good; mv clisp good; else rm -rf bad; mv clisp bad; fi

    Is the test-clisp command succeeded, then set good-date to m, otherwise set bad-date to m.

  4. Repeat the previous listitem until there is only one CVS commit between bad-date and good-date.

See output of CVS log for the acceptable date format for CVS co -D.

A.1.2. Logo

A.1.2.1. Why is CLISP using menorah as the logo?
A.1.2.2. Shouldn't the logo be changed now due to the current political developments in the Middle East?
A.1.2.3. Aren't there other political issues of concern?
A.1.2.4. Aren't you afraid of losing some users who are offended by the logo?
A.1.2.5. Using software to promote a political agenda is unprofessional!

A.1.2.1.

Why is CLISP using menorah as the logo?

Whimsical

If you must have some answer and you do not care whether it is correct or not, you may simply think that Common Lisp brings the Light to a programmer, and CLISP is a vehicle that carries the Light.

Accordingly, CLISP enables you to see the truth, thus you can pronounce it as see-lisp. Alternatively, if you are a seasoned expert, you might pronounce it as sea-lisp.

Historical

CLISP has been using the menorah for the logo since the project was first started in the late 1980-ies by Bruno Haible and Michael Stoll. This probably reflects the authors' affection toward the Jewish people, Judaism or the State of Israel (neither of the two original authors is Jewish by birth). You may ask the original authors for details yourself. Both of them are very busy though, so do not expect a prompt reply.

A.1.2.2.

Shouldn't the logo be changed now due to the current political developments in the Middle East?

The CLISP developers, both the original creators and the current maintainers, do not subscribe to the mainstream view that blames the Jews for everything from high oil prices and Islamic extremism to El Niño and global warming (or cooling, whatever the looming disaster du jour is).

Moreover, today, when Jews are being pushed out of the American and European academic institutions with various obscene boycott and divestment campaigns, it is crucial for all of us to stand together against the resurgence of Nazism.

For more information, please see:

A.1.2.3.

Aren't there other political issues of concern?

Yes, there are! For example, in 1989 the communist government of the People's Republic of China murdered some 3000+ student human rights protesters at the Tienanmen square in Beijing, and people appear to have already forgotten this crime. A note to that effect was kept in the file src/timezone.lisp until 2002, when it was decided that is was not visible enough there and it was moved here.

We also oppose software patents and support other liberal (i.e., pro-liberty) causes.

A.1.2.4.

Aren't you afraid of losing some users who are offended by the logo?

Do you have in mind people like this one? Good riddance!

A.1.2.5.

Using software to promote a political agenda is unprofessional!

Expressing their opinion is a perfectly natural thing for the authors, be it artistic preferences, political views or religious beliefs. The use of the menorah has its roots somewhere between these areas, and the authors are proud to display it. If you are unlucky enough to have lost the freedom to express your opinion, due to the constraints of a government, society, religion, or expectations of professional relationships, the Free World condoles with you. The authors of CLISP are not operating under such constraints. If you are unhappy about their artistic preferences, political views or religious beliefs, you are free to ignore them.

Many scientists have been doing art, politics and religion. René Descartes and Isaak Newton combined mathematics and Christianity. Albert Einstein helped the U.S. to counter the danger of an atomic bomb in the hands of the Nazis. Bram Moolenaar, the author of VIM, promotes charitable donations to Uganda.

A.2. Running CLISP

A.2.1. Why are floats printed in binary?
A.2.2. Where is the IDE?
A.2.3. What are the command line arguments?
A.2.4. How do I get out of the debugger?
A.2.5. What CLISP extensions are available?
A.2.6. Where is the init (“RC”) file on my platform?
A.2.7. Where are the modules with which I built CLISP?
A.2.8. How do I create a GUI for my CLISP program?

A.2.1.

Why are floats printed in binary?

Where is DEFUN?

Pass -M to the runtime (lisp.run or lisp.exe). Or, better yet, use the driver clisp (or clisp.exe) instead of invoking the runtime directly.

A.2.2.

Where is the IDE?

Emacs-based

non-Emacs-based

A.2.3.

What are the command line arguments?

See clisp(1).

A.2.4.

How do I get out of the debugger?

See Section 25.2, “Debugging Utilities ”.

A.2.5.

What CLISP extensions are available?

bundled

Quite a few modules are included with CLISP, pass --with-module=... to configure to build them and see Q: A.2.7.

3rd party

See the incomplete list of Common Lisp software running in CLISP”.

DIY

See Section 32.2, “External Modules” and Section 32.3, “The Foreign Function Call Facility” for information on how to interface with external C libraries.

HTTP

Very Frequently Asked!

Both AllegroServe and CL-HTTP require multithreading and do not work with CLISP yet.

A.2.6.

Where is the init (RC) file on my platform?

Read the file <clisp.html#opt-norc> in your build directory or binary distribution (this is the version of the user manual clisp(1) for your platform).

A.2.7.

Where are the modules with which I built CLISP?

In the full linking set. Run CLISP like this:

$ clisp -K full

Unless your CLISP was configured with option --without-dynamic-modules, you should instead use (REQUIRE name) where name is a STRING, e.g., rawsock, or clx (for either clx/new-clx or clx/mit-clx, whichever is installed), or linux (for bindings/glibc) etc. This is more reliable because the full linking set may include many modules which you do not need and, in fact, cannot use because they require external libraries not installed on your system.

Making base the default linking set has some advantages:

Shared Library Hell
Avoid problems when a module requires a shared library, and that shared library is not present (or is present but with wrong version) on your system.
Smaller Images Are Faster
Adding things to the heap increases working set size causing a slowdown, which is especially important for small to medium applications.
Uniform User Experience
Composition of the full linking set is up to the packager, while base is the same on all platforms.

See clisp-list for more information (SFmail/200407212204.44395.bruno%40clisp.org/Gmane/general/8691).

A.2.8.

How do I create a GUI for my CLISP program?

Use module gtk2: create ui.glade with Glade, then do

$ ./configure --with-module=gtk2 --cbc build-gtk
$ ./build-gtk/clisp -K full -x '(gtk:run-glade-file "ui.glade")'

There are many other options, see "Common Lisp software running in CLISP".

A.3. Application Delivery

A.3.1. How do I create an executable file with all my code in it?
A.3.2. When I deliver my application with CLISP, does it have to be covered by the GNU GPL?

A.3.1.

How do I create an executable file with all my code in it?

Use EXT:SAVEINITMEM, see also Section 32.6, “Quickstarting delivery with CLISP.

A.3.2.

When I deliver my application with CLISP, does it have to be covered by the GNU GPL?

Not necessarily.

CLISP is Free Software, covered by the GNU GPL, with special terms governing the distribution of applications that run in CLISP. The precise terms can be found in the COPYRIGHT file contained in the source and binary distributions of CLISP. Here is an informal clarification of what these terms mean in practice. Please refer to the said COPYRIGHT file when in doubt.

In many cases, CLISP does not force an application to be covered by the GNU GPL. Nevertheless, we encourage you to release your software under an open source license. The benefits of such a license for your users are numerous, in particular they are free to modify the application when their needs/requirements change, and they are free to recompile the application when they upgrade their machine or operating system.

CLISP extensions, i.e. programs which need to access non-portable CLISP internal symbols (in the packages SYSTEM, CLOS, FFI, etc), must be covered by GNU GPL as well.

Other programs running in CLISP have to or need not to be placed under GNU GPL, depending on their distribution form:

  • Programs distributed as Lisp source or #P".fas" files can be distributed without restrictions coming from CLISP.
  • Programs distributed as CLISP memory images can be distributed only if accompanied with the non-CLISP #P".fas" files which make up the memory image, and a Makefile (or clear textual instructions) for rebuilding the memory image.
  • If you need to distribute a modified CLISP executable (for example, incorporating additional modules written in C), you must distribute its full source under GNU GPL. If you are not satisfied with this, you can instead put the additional modules into a separate (non-CLISP) program, with which your Lisp program will communicate via SOCKET:SOCKET-STREAMs.

A.4. Troubles

A.4.1. Where is the binary distribution for my platform?
A.4.2. But a previous release had a binary distribution for my platform, why does not the current one?
A.4.3. Why does not CLISP build on my platform?
A.4.4. Why is the --with-libsigsegv-prefix option ignored by the configure script on my 64-bit machine?
A.4.5. What do charset errors mean?
A.4.6. What does this message mean: “Display all 1259 possibilities? (y or n)”
A.4.7. Why does not command line editing work?
A.4.8. How do I avoid stack overflow?
A.4.9. Why does my program return different values on each invocation?
A.4.10. Is floating point arithmetic broken?
A.4.11. Is RANDOM broken?
A.4.12. Why is an extra line break inserted by the pretty printer?
A.4.13. How do I disable this annoying warning?
A.4.14. Why does DEFVAR affect previously defined lexical closures?
A.4.15. The error message is not helpful!
A.4.16. Why is the function FOO broken?!

A.4.1.

Where is the binary distribution for my platform?

The CLISP maintainers do not offer CLISP binary distributions, we believe that software packagers specializing on a particular platform are in a better position to provide quality binaries. Indeed, the section Get CLISP on the CLISP's home page points to CLISP packages for all major Linux and *BSD variants.

The only exception is Win32 for which there is no centralized packager: usually, after each CLISP release, a CLISP user volunteers to build a Win32 binary package, which we then distribute at http://sourceforge.net/project/showfiles.php?group_id=1355.

A.4.2.

But a previous release had a binary distribution for my platform, why does not the current one?

It was probably contributed by a user who did not (yet?) contribute a binary distribution for the current release. You can find out who contributed a specific binary distribution by looking at the release notes in the SourceForge Files section.

A.4.3.

Why does not CLISP build on my platform?

Please see file unix/PLATFORMS in your source distribution for information about some known troublesome platforms as well as instructions on porting CLISP to new platforms.

A.4.4.

Why is the --with-libsigsegv-prefix option ignored by the configure script on my 64-bit machine?

See a note on bi-arch systems in section 2 of unix/INSTALL in your source distribution (for the impatient: pass --libdir=='${exec_prefix}/lib64' to the GNU libsigsegv configure).

See these threads which discuss the situation in depth:

http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/14565
http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/10827

A.4.5.

What do these error messages mean: invalid byte #x94 in CHARSET:ASCII conversion and character #\u00B3 cannot be represented in the character set CHARSET:ASCII?

This means that you are trying to read (invalid byte) or write (character cannot be represented) a non-ASCII character from (or to) a character stream which has ASCII :EXTERNAL-FORMAT. The default is described in -Edomain encoding.

This may also be caused by filesystem access. If you have files with names incompatible with your CUSTOM:*PATHNAME-ENCODING*, filesystem access (e.g., DIRECTORY) will SIGNAL this ERROR. You will need to set CUSTOM:*PATHNAME-ENCODING* or pass -Edomain encoding to CLISP. Using a 1:1 encoding, such as CHARSET:ISO-8859-1, should help you avoid this error.

Note that this error may be signaled by the Print part of the read-eval-print loop and not by the function you call. E.g., if file "foo" contains non-ASCII characters, you will see such an error when you type

(WITH-OPEN-FILE (s "foo" :direction :input :EXTERNAL-FORMAT CHARSET:ISO-8859-1)
  (READ-LINE s))

If instead you type

(WITH-OPEN-FILE (s "foo" :direction :input :EXTERNAL-FORMAT CHARSET:ISO-8859-1)
  (SETQ l (READ-LINE s))
  NIL)

CLISP will just print NIL and signal the error when you type l.

A.4.6.

What does this message mean: Display all 1259 possibilities? (y or n)

CLISP uses GNU readline for command line editing and completion. You get this Display all 1259 possibilities message (and sometimes many screens of symbols) when you hit TAB too many times in an inappropriate place. You can turn this feature off if you are using Emacs. It is a good idea not to use TABs in your code.

A.4.7.

Why does not command line editing work?

See Section 21.2.1, “Command line editing with GNU readline”.

A.4.8.

How do I avoid stack overflow?

CLISP has two stacks, the program stack and the lisp stack, and both may occasionally overflow.

Generic

  • You will always get a stack overflow when you try to print a circular object (LIST, STRUCTURE-OBJECT, VECTOR etc) and *PRINT-CIRCLE* is NIL. Just set *PRINT-CIRCLE* to T.
  • You will always get a stack overflow on infinite recursion.
  • Some simple functions (like Ackermann's) recurse more than you might expect and can run out of stack on relatively small inputs.
  • Compiled code uses less stack (and memory) and is faster.
  • If you really do need more Lisp stack, you can increase it by telling CLISP to pre-allocate more memory using -m or MT:MAKE-THREAD.
  • If you get a segmentation fault after (or instead of) a program stack overflow message, please make sure that you had GNU libsigsegv installed when you configured and built CLISP.

Specific

Platform Dependent: Win32 platform only.

You have several option, use whichever is applicable to your situation:

Platform Dependent: UNIX platform only.
Increase program stack with ulimit -s (or limit stacksize if you are using csh) to at least 8 MB.

A.4.9.

Why does my program return different values on each invocation?

The following code modifies itself:

(let ((var '(a b c)))
  (nconc var '(1 2 3)))

and will not work as one would naively expect. (on the first invocation, it will return (a b c 1 2 3), the second invocation will produce a circular list, the third will hang trying to NCONC a circular list).

Instead you must do

(let ((var (copy-list '(a b c))))
  (nconc var (copy-list '(1 2 3))))

DISASSEMBLE will show the constants in your compiled functions. See Chapter 37, The CLISP bytecode specification for the explanation of the DISASSEMBLE output.

See Lisp Programming Style for more useful information.

A.4.10.

Why don't floating point arithmetic return what I want?

(- 1.1 0.9)
⇒ 0.20000005

inexact

Floating point arithmetic is inherently inexact, so this not a bug, at least not a bug in CLISP. You may argue that this is a bug in IEEE 754, but, before you do, please make sure that you do know What Every Computer Scientist Should Know About Floating-Point Arithmetic (or are at least familiar with the light version thereof).

See also clisp-list (SFmail/17121.26476.75643.47774%40thalassa.informatimago.com/Gmane/general/9850).

exact

If you want exact calculations, use RATIONALs:

(- 11/10 9/10)
⇒ 1/5

A.4.11.

Why does

$ clisp -x '(RANDOM 1s0)'

always print the same number?

Reproducibility is important. See Section 12.2.7, “Random-State Operations ”.

A.4.12.

Why is an extra line break inserted by the pretty printer?

See the section called “Variable CUSTOM:*PPRINT-FIRST-NEWLINE*.

For example, here you are pretty-printing two objects: a one-liner #\Q and a two-liner CR+LF, and a line break is inserted between them so that they are printed on separate lines:

(defparameter crlf (coerce '(#\Return #\Linefeed) 'string))
⇒ CRLF
(map 'list #'char-code (format nil "Q~a" crlf))
⇒ (81 10 13 10)not (81 13 10) !

When you want CR+LF-terminated lines, use :EXTERNAL-FORMAT :DOS argument when opening your STREAMs.

A.4.13.

How do I disable this annoying warning?

CLISP often issues WARNINGs when it encounters suspicious behavior. It is best to fix your code rather than to suppress them. To figure out where the warning is coming from, do (SETQ *BREAK-ON-SIGNALS* 'WARNING) and examine the stack in the debugger to see where the warning is coming from.

If everything else fails, read the manual.

A.4.14.

Why does DEFVAR affect previously defined lexical closures?

(defun adder (val) (lambda (x) (+ x val)))
⇒ ADDER
(setq add-10 (adder 10))
⇒ ADD-10
(funcall add-10 32)
⇒ 42as expected
(defvar val 12)
⇒ VAL
(funcall add-10 0)
⇒ 12why not 10?!

Explanation

The above code does not conform to [ANSI CL standard], therefore CLISP can produce arbitrary results. See Section 3.2.2.3, “Semantic Constraints ”.

Remedy

Always follow the naming convention for global special variables defined by DEFVAR and DEFPARAMETER (e.g., *FOO*) and DEFCONSTANT (e.g., +BAR+).

More

SFmail/470A4B2A.30306%40gnu.org/Gmane/general/11945
SFmail/200710090043.01871.bruno%40clisp.org/Gmane/general/11949

A.4.15.

The error message is not helpful!

Sometimes an error message contains a compound object whose content you want to examine. Often this object will be available for INSPECTion via the Inspect command (see Table 25.3, “Commands common to the debugger and the stepper”). E.g.,

*** - READ: input stream #<INPUT STRING-INPUT-STREAM> ends within an object
The following restarts are available:
ABORT          :R1      ABORT
Break 4 [1]> :i
#<SYSTEM::SIMPLE-END-OF-FILE #x000333CB82F8>:  standard object
 type: SYSTEM::SIMPLE-END-OF-FILE
0 [$STREAM]:  #<INPUT STRING-INPUT-STREAM>
1 [$FORMAT-CONTROL]:
"~S: input stream ~S ends within an object
"
2 [$FORMAT-ARGUMENTS]:  (READ #<INPUT STRING-INPUT-STREAM>)
INSPECT-- type :h for help; :q to return to the REPL ---> 0
#<INPUT STRING-INPUT-STREAM>:  atom
 type: STRING-STREAM
 class: #1=#<BUILT-IN-CLASS STRING-STREAM>
INSPECT-- type :h for help; :q to return to the REPL ---> :d

#<INPUT STRING-INPUT-STREAM> is an input-stream. It reads from "(foo" from 0 to 4 at 4.

A.4.16.

Why is the function FOO broken?!

When confronted with unexpected behavior, try looking in the CLISP impnotes.

E.g., CLISP DIRECTORY is different from the CMU CL implementation, so, to find out how to get the results you want, you should search the CLISP implementation notes for "DIRECTORY".

Alternatively, since the implementation notes are organized in parallel to the [ANSI CL standard], and DIRECTORY belongs to the Chapter 20 in [ANSI CL standard], you can just go to Chapter 20, Files in impnotes and look for "DIRECTORY" there.


These notes document CLISP version 2.49Last modified: 2010-07-07