This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Array element type: CLISP / SBCL

2 posts · 3761 views

Hi all,
glad to be a fresh new member of this forum. I'm pretty sure to spend a lot of time reading it!

here is my question:
I'm trying to understand differences between array in CLISP and SBCL.
It appears that the following 2 lines work well in CLISP but raise type-error in SBCL (SBCL doesn't allow to replace a matrix element by an expression, nor a integer, etc...)

(setq x (make-array '(10 3) :element-type 'double-float) )
(setf (aref x 0 0) 'foo)


Is really CLISP so user-friendly?
It seems to be a real difference, leading to (i guess) significative performance difference too!

Re: Array element type: CLISP / SBCL

What you really mean is that it doesn't work in CLISP -- you've asked that the array only be able to hold double-floats, and then tried to put a symbol into it. Since a symbol is not a double-float, this should be an error. But no Lisp can have specialized arrays for every possible type, so you can usually put something more into the array than you asked for. E.g., if you make an array with :element-type '(integer 8 42) you're asking it to only accept integers between 8 and 42, but for sure it'll be able to store more than that. Obviously in CLISP an array of type double-float is equivalent to an array of type T (i.e., you can store anything at all in it...such as symbols).