<br><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 5:09 AM, Niitsuma Hirotaka <span dir="ltr"><<a href="mailto:hirotaka.niitsuma@gmail.com">hirotaka.niitsuma@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I can not find convert function<br>
#A(...) -> #m(...)<br>
<br>
( cl-array is conversion #m -> #a )<br>
<br>
Thus I write the following ,but that looks slow.<br>
--------------<br>
(defun coerce-array-to-list (in-array)<br>
(map 'list<br>
#'identity<br>
(make-array (array-total-size in-array)<br>
:element-type (array-element-type in-array)<br>
:displaced-to in-array)))<br>
;borrow from <a href="http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/a925ca60d88d4047/cc06e579dfe840a7?lnk=gst&q=displaced+array" target="_blank">http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/a925ca60d88d4047/cc06e579dfe840a7?lnk=gst&q=displaced+array</a><br>
<br>
<br>
(defun appropriate-name (element-type ar)<br>
(make-marray element-type :dimensions (array-dimensions ar)<br>
:initial-contents (coerce-array-to-list ar))<br>
)<br>
---------------<br>
<br>
usage:<br>
( appropriate-name 'double-float #2A((1.0d0 2.0d0) (2.0d0 5.0d0)))<br>
-><br>
#m((1.0d0 2.0d0) (2.0d0 5.0d0)))<br>
<br>
_______________________________________________<br>
Gsll-devel mailing list<br>
<a href="mailto:Gsll-devel@common-lisp.net">Gsll-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel</a><br>
</blockquote></div><br>I don't know an answer better than yours. I would name the function gsll-array. <br>Also, since marray's are objects, you may want to look into its constructor to see how the array is stored.<br>
<br>I was bitten a few times by the make-marray syntax that requires a list input.<br><br>(As far as I see, lisp's coerce syntax prevents us from customizing it to do the job we want.)<br><br>Mirko<br>