Package: clisp Version: 1:2.44.1-4.1 Severity: normal Hello. I'm trying to learn Common Lisp with the help of the book
Stuart Shapiro. Common Lisp. An Interactive Approach. On the page 90 of this book there is an example of defining your own version of 'length'. I've tried to repeat it in clisp. Everything works fine but in case I pass a wrong argument to 'length and then substitute it with the right one, the function returns an incorrect answer. Here is the example: [1]> (defpackage "TEST" (:use "COMMON-LISP")) #<PACKAGE TEST> [2]> (in-package test) #<PACKAGE TEST> TEST[3]> (shadow 'length) T TEST[4]> (defun length (l) (check-type l list) (if (null l) 0 (1+ (length (rest l))))) LENGTH TEST[5]> (length '(1 2 3 4 5)) 5 TEST[6]> (length "abc") *** - The value of L should be of type LIST. The value is: "abc" The following restarts are available: STORE-VALUE :R1 You may input a new value for L. ABORT :R2 Abort main loop Break 1 TEST[7]> :R1 New L: '(1 2 3 4 5) 2 TEST[8]> Why the result is 2? It should be 5! Thank you -- System Information: Debian Release: 5.0.7 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-2-amd64 (SMP w/6 CPU cores) Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages clisp depends on: ii common-lisp-controller 6.17 Common Lisp source and compiler ma ii libc6 2.7-18lenny6 GNU C Library: Shared libraries ii libdb4.6 4.6.21-11 Berkeley v4.6 Database Libraries [ ii libffcall1 1.10+2.41-3 Foreign Function Call Libraries ii libncurses5 5.7+20081213-1 shared libraries for terminal hand ii libreadline5 5.2-3.1 GNU readline and history libraries ii libsigsegv0 2.5-2 Library for handling page faults i ii libx11-6 2:1.1.5-2 X11 client-side library ii libxau6 1:1.0.3-3 X11 authorisation library ii libxext6 2:1.0.4-2 X11 miscellaneous extension librar ii libxpm4 1:3.5.7-1 X11 pixmap library clisp recommends no packages. Versions of packages clisp suggests: pn clisp-dev <none> (no description available) pn clisp-doc <none> (no description available) pn gdb <none> (no description available) ii slime 1:20080223.dfsg-1 Superior LISP Interaction Mode for -- no debconf information -- Miĥail Vasiljev <gnu.x...@gmail.com> -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org