[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with arrays in Franz
- To: FRANZ-FRIENDS@Berkeley
- Subject: Problems with arrays in Franz
- From: Dan Hoey <hoey@NRL-AIC>
- Date: Wed, 11 Jan 84 19:43:00 GMT
- Original-date: 11 Jan 1984 14:43-EST
Hard to believe but it was less than two and a half years ago that
someone was having trouble using Franz arrays...
Date: 17 Jul 1981 17:06:22-PDT
From: CSVAX.jkf at Berkeley
cc: franz-friends at MIT-MC
Subject: Re: ... the maclisp-style array package.
In-reply-to: Your message of 17 Jul 1981 1347-PDT (Friday).
Subject: ... the maclisp-style array package.
 We've been having problems with the MacLisp compatable array
package - it doesn't work! Does anyone have a debugged version?
Can you be more specific? We use it in Vax Macsyma without any problems.
Personally I feel that Maclisp arrays were invented by a madman and no new
code should be written using them.
-- john foderaro
Well, I used the Maclisp array package because I didn't want to waste
time writing my own. Instead I spent hours looking for the bug in this
-> (let ((factorial (*array () () 100.)))
(store (factorial 0) 1)
(do ((i 1 (1+ i)))
((= i 100.))
(store (factorial i) (times i (factorial (1- i)))))
To make a long story short, this lossage is because the second argument
to *array being nil tells the garbage collector not to scan the
array. The factorial of ten gets tossed in the bit bucket, where it
unfortunately looks like a fixnum. To fix the example, change the
first line of the example to
-> (let ((factorial (*array () t 100.)))
To save someone else from excruciatingly wrong answers, change the
documentation in Section 2.
(*array 's_name 's_type 'x_dim1 ... 'x_dimn)
(array s_name s_type x_dim1 ... x_dimn)
WHERE: s_type may be one of t, nil, fixnum, flonum,
fixnum-block and flonum-block.
< In FRANZ LISP arrays of type t, nil, fix-
< num and flonum are equivalent and the elements of
< these arrays can be any type of lisp object.
> In FRANZ LISP arrays of type t, fixnum,
> and flonum are equivalent and the elements of
> these arrays can be any type of lisp object.
> Type nil arrays may also contain any type of lisp
> object, but they are not marked by the garbage
> collector (see 9.2.2) and can lose data if used
Fixnum-block and flonum-block arrays are res-
tricted to fixnums and flonums respectively and
are used mainly to communicate with foreign func-
tions (see 8.4).