From: Leslie P. Polzer
Subject: An array has been shortened by adjusting it while another array was 	displaced to it.
Date: 
Message-ID: <daffb193-4856-4dd3-9b5a-38771bb35f12@8g2000hse.googlegroups.com>
This code

      ;; remove shebang if it's there
      (and (> buffer-size 1) (eql (elt buffer 0) #\#) (eql (elt buffer
1) #\!)
           (let* ((first-newline (1+ (position #\Newline buffer)))
                  (new-buffer (remove-if (constantly t) buffer :start
0 :end first-newline)))
             (setf buffer new-buffer)))

where BUFFER is either one of

  (make-array buffer-size :element-type 'character)
  (make-string buffer-size)

filled with file contents and BUFFER-SIZE is set accordingly,
miserably fails at least on CLISP 2.46 with

"An array has been shortened by adjusting it while another array was
displaced to it."

What's up with that?

  Leslie

From: Vassil Nikolov
Subject: Re: An array has been shortened by adjusting it while another array was  displaced to it.
Date: 
Message-ID: <snzr6a7m8cw.fsf@luna.vassil.nikolov.name>
On Sun, 6 Jul 2008 02:32:22 -0700 (PDT), "Leslie P. Polzer" <·············@gmx.net> said:

| This code
|       ;; remove shebang if it's there
|       (and (> buffer-size 1) (eql (elt buffer 0) #\#) (eql (elt buffer 1) #\!)
|            (let* ((first-newline (1+ (position #\Newline buffer)))
|                   (new-buffer (remove-if (constantly t) buffer :start 0 :end first-newline)))
|              (setf buffer new-buffer)))

| where BUFFER is either one of

|   (make-array buffer-size :element-type 'character)
|   (make-string buffer-size)

| filled with file contents and BUFFER-SIZE is set accordingly,
| miserably fails at least on CLISP 2.46 with

| "An array has been shortened by adjusting it while another array was
| displaced to it."

  Can you show us the full code and full backtrace from the error,
  ideally for the simplest case that allows it to be reproduced in
  isolation?

  As an aside, consider (STRING= "#!" BUFFER :START2 0 :END2 2),
  rather than (EQL (ELT BUFFER 0) #\#) (EQL (ELT BUFFER 1) #\!).

  ---Vassil.


-- 
Peius melius est.  ---Ricardus Gabriel.
From: Pascal J. Bourguignon
Subject: Re: An array has been shortened by adjusting it while another array was  displaced to it.
Date: 
Message-ID: <87bq1bux0g.fsf@hubble.informatimago.com>
"Leslie P. Polzer" <·············@gmx.net> writes:

> This code
>
>       ;; remove shebang if it's there
>       (and (> buffer-size 1) (eql (elt buffer 0) #\#) (eql (elt buffer
> 1) #\!)
>            (let* ((first-newline (1+ (position #\Newline buffer)))
>                   (new-buffer (remove-if (constantly t) buffer :start
> 0 :end first-newline)))
>              (setf buffer new-buffer)))
>
> where BUFFER is either one of
>
>   (make-array buffer-size :element-type 'character)
>   (make-string buffer-size)
>
> filled with file contents and BUFFER-SIZE is set accordingly,
> miserably fails at least on CLISP 2.46 with
>
> "An array has been shortened by adjusting it while another array was
> displaced to it."
>
> What's up with that?


Well it 2.41 it works, and there's no reason why it shouldn't work in
all conforming implementation.  It may be a bug in 2.46.  Ask on
·················@lists.sourceforge.net

C/USER[60]> (let ((buffer-size 10))
              (dolist (buffer (list (make-array buffer-size :element-type 'character)
                                    (make-string buffer-size)))
                (and (> buffer-size 1)
                     (eql (elt buffer 0) #\#)
                     (eql (elt buffer 1) #\!)
                     (let* ((first-newline (1+ (position #\Newline buffer)))
                            (new-buffer (remove-if (constantly t) buffer :start 0 :end first-newline)))
                       (setf buffer new-buffer)))))

NIL
C/USER[61]> (lisp-implementation-version)
"2.41 (2006-10-13) (built on thalassa.lan.informatimago.com [192.168.1.198])"
C/USER[62]> 


Note that (if first-newline (subseq buffer (1+ first-newline)) buffer)
might be more efficient than remove-if constantly...

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NEW GRAND UNIFIED THEORY DISCLAIMER: The manufacturer may
technically be entitled to claim that this product is
ten-dimensional. However, the consumer is reminded that this
confers no legal rights above and beyond those applicable to
three-dimensional objects, since the seven new dimensions are
"rolled up" into such a small "area" that they cannot be
detected.