The following works in sbcl+grid:
(copy-to (make-array 2 :element-type 'double-float :initial-contents '(1.0d0 2.0d0)) 'grid:foreign-array)
But it does not work in clisp+grid.
The root cause lies in the function grid/array.lisp/element-type. It uses `(array-element-type grid)'.
But this can present a problem. Quoting hyperspec:
(Because of array
upgrading, this type specifier can in some cases denote a supertype of the expressed
array element type of the array.)
In CLISP, array-element-type returns `T' when passed #(1d0 2d0)
It returns T even when passed a simple array:
(array-element-type (make-array 2 :element-type 'double-float :initial-contents
'(1.0d0 2.0d0)
:adjustable nil
:fill-pointer nil
:displaced-to nil) )
The proposed fix is
(defmethod element-type ((grid array))
(type-of (row-major-aref grid 0))
#+skip(array-element-type grid))
Now copy-to works in clisp as well.
Mirko