From: Jack Vinson
Subject: Array problem - adjust-array
Date: 
Message-ID: <51201@netnews.upenn.edu>
I've just started using arrays in Lucid Lisp, and have run into a strange
problem.  Basically, I've been creating adjustable arrays, and then adjusting
them (of course).  But when I attempt to adjust from a '(1 3) array to '(4 3)
it bombs.  Actually, if I adjust any 2-D array to '(4 3) it bombs.  What the
heck is happening?  It just started about 1/2 hour ago, and was working fine
before this.

For now I'm going to get out of lisp and reload everything (a pain).  Does
anyone have a clue about this?  Is it possible that I have too many arrays
laying around?  I'm doing a lot of testing and reset the variables which hold
the arrays to new arrays.

Below is a copy of my session with lisp that gives you the idea of the problem:

Thanks, folks

Jack

;;; My strange session with Lucid Lisp
> (setq a (make-array '(1 3) :adjustable t))
#2A((NIL NIL NIL))
> (adjust-array a '(4 3))
#2A((NIL NIL NIL) (
>>Error: The index 1 for dimension 0 of array #2A((NIL NIL NIL) (#<FORMAT ERROR>

AREF:
   Required arg 0 (ARRAY): #2A((NIL NIL NIL) (
#<FORMAT ERROR>
   Optional arg 1 (I1): 1
   Optional arg 2 (I2): 0
   Rest arg 3 (MORE-SUBSCRIPTS): NIL
:C  0: Supply an index.
:A  1: Abort to Lisp Top Level

-> 1
Abort to Lisp Top Level
Back to Lisp Top Level

> (adjust-array a '(1 3))
#2A((NIL NIL NIL))
> (adjust-array a '(5 3))
#2A((NIL NIL NIL) (0 0 0) (0 0 0) (0 0 0) (0 0 0))
> (aref a 4 2)
0

From: Stephen E. Bacher
Subject: Re: Array problem - adjust-array
Date: 
Message-ID: <RNETMAIL9109200823240SEB1525@MVS.DRAPER.COM>
On 19 Sep 91 20:23:59 GMT Jack Vinson <······@linc.cis.upenn.edu> wrote
about a problem with adjust-array in Lucid Lisp.  He enclosed the
following session transcript:

>;;; My strange session with Lucid Lisp
>> (setq a (make-array '(1 3) :adjustable t))
>#2A((NIL NIL NIL))
>> (adjust-array a '(4 3))
>#2A((NIL NIL NIL) (
>>>Error: The index 1 for dimension 0 of array #2A((NIL NIL NIL) (#<FORMAT ERROR>
>
>AREF:
>   Required arg 0 (ARRAY): #2A((NIL NIL NIL) (
>#<FORMAT ERROR>
>   Optional arg 1 (I1): 1
>   Optional arg 2 (I2): 0
>   Rest arg 3 (MORE-SUBSCRIPTS): NIL
>:C  0: Supply an index.
>:A  1: Abort to Lisp Top Level

This is why I don't believe in error messages of the form

 Error: The object FOO, a GIZMO of type FROBBOZ, is not blah-blah-blah...

In Zil (the IBM/MVS Lisp we developed at Draper), error messages are
almost always in the form

 Error: Argument is not blah-blah-blah - FOO

This may strike some as ugly and "FORTRANish", but there is an
undeniable advantage in having the argument at the end of the
message rather than in the "subject" position.

If the object in error should fail to be printed out, as in Jack's
problem, you at least get to see the part of the error message that
describes the problem.  With Lucid's style of error message, the FORMAT
ERROR aborts the error display before it even gets a chance to tell you
what the error is.  That's not what I call user-friendly.

  - SEB
From: Barry Margolin
Subject: Re: Array problem - adjust-array
Date: 
Message-ID: <1991Sep20.205455.17121@Think.COM>
In article <·····@netnews.upenn.edu> ······@linc.cis.upenn.edu (Jack Vinson) writes:
>;;; My strange session with Lucid Lisp
>> (setq a (make-array '(1 3) :adjustable t))
>#2A((NIL NIL NIL))
>> (adjust-array a '(4 3))
>#2A((NIL NIL NIL) (
>>>Error: The index 1 for dimension 0 of array #2A((NIL NIL NIL) (#<FORMAT ERROR>

Try specifying the :INITIAL-ELEMENT option to ADJUST-ARRAY.  According to
CLtL, "if this argument is not provided, then the initial contents of any
new elements are undefined."  It looks like Lucid is leaving garbage there,
which is an allowable "undefined" content.
-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar