<div dir="ltr"><div><div>I am attached to clisp on windows for some unfathomable reason - for me it has been very robust (I use sbcl on linux)<br><br></div>However, I will stop reporting clisp related issues unless I convince myself that they are related to ansi-spec conformance and portability.<br>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 25, 2013 at 8:14 PM, Liam Healy <span dir="ltr"><<a href="mailto:lhealy@common-lisp.net" target="_blank">lhealy@common-lisp.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My fix (as opposed to your fix) to the problem you reported in your previous email should not exhibit this problem, see my previous email. A better summary is CLISP is not a preferred platform for anything. There is a Windows port of SBCL, and has been for quite some time. A better cross-check on portability would be CCL.<br>
<br><div>Liam<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Fri, Jan 4, 2013 at 11:47 AM, Mirko Vukovic <span dir="ltr"><<a href="mailto:mirko.vukovic@gmail.com" target="_blank">mirko.vukovic@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">This is a follow up on my posted fix to copy-to. For some reason this has triggered another<br>
error. I do not understand how that other error is triggered. The error and the fix are discussed <br>
at the bottom of the email<br>
<br><div class="gmail_quote">On Fri, Jan 4, 2013 at 10:39 AM, Mirko Vukovic <span dir="ltr"><<a href="mailto:mirko.vukovic@gmail.com" target="_blank">mirko.vukovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The following works in sbcl+grid:<br><br>(copy-to (make-array 2 :element-type 'double-float :initial-contents '(1.0d0 2.0d0)) 'grid:foreign-array)<br><br>But it does not work in clisp+grid.<br><br>The root cause lies in the function grid/array.lisp/element-type. It uses `(array-element-type grid)'. <br>
<br>But this can present a problem. Quoting hyperspec:<br><br>(Because of <a href="http://26_glo_a.htm#array" rel="DEFINITION" target="_blank"><i>array</i></a>
<i>upgrading</i>, this <a href="http://26_glo_t.htm#type_specifier" rel="DEFINITION" target="_blank"><i>type specifier</i></a> can in some cases denote a <a href="http://26_glo_s.htm#supertype" rel="DEFINITION" target="_blank"><i>supertype</i></a> of the <a href="http://26_glo_e.htm#expressed_array_element_type" rel="DEFINITION" target="_blank"><i>expressed
array element type</i></a> of the <i>array</i>.) <br><br>In CLISP, array-element-type returns `T' when passed #(1d0 2d0)<br><br>It returns T even when passed a simple array:<br><br>(array-element-type (make-array 2 :element-type 'double-float :initial-contents<br>
'(1.0d0 2.0d0)<br> :adjustable nil<br> :fill-pointer nil<br> :displaced-to nil) )<br><br>The proposed fix is<br><br>(defmethod element-type ((grid array))<br>
(type-of (row-major-aref grid 0))<br> #+skip(array-element-type grid))<br><br>Now copy-to works in clisp as well.<span><font color="#888888"><br><br>Mirko<br><br><br>
</font></span></blockquote></div>After finishing this, I recompiled afresh, and got another error that I traced to make-grid-data and make-array<br><br>In clisp, make-array will return an array of NIL's even if the element-type is specified as double float. In SBCL make-array<br>
will return an array filled with 1d0.<br><br>I had to add some clisp specific code to make-grid-data in order for it to initialize properly.<br><br>First, a helper function:<br>(defun default-element (element-type)<br> "Return a default element depending on element-type<br>
"<br> (let ((a-list '((double-float . 1d0)<br> (symbol . T))))<br> (let ((match (cdr (assoc element-type a-list))))<br> (assert match ()<br> "Default element type undefined for element-type ~a"<br>
element-type)<br> match)))<br><br>And second, a bit of set-up code in make-grid-data. I broke apart the (let* statement<br>to provide an explicit initial element if it has not been specified already:<br>
<br>(defmethod make-grid-data<br> ((type (eql 'array)) dimensions rest-spec<br> &key (initial-element nil initial-element-p)<br> (initial-contents nil initial-contents-p))<br> (let ((element-type (top-spec-type rest-spec)))<br>
#+clisp<br> (unless (or initial-element-p<br> initial-contents-p)<br> (setf initial-element (default-element element-type)<br> initial-element-p t))<br> (let ((array ... UNCHANGED<br><br><br>
Summary: To fix to copy-to, I modified (defmethod element-type ((grid array))<br>
For some unknown reason, that triggered an error in the array initialization routine.<br>To fix that, I had to add code to make-grid-data, so that it fills double-float arrays with 0d0<br>instead of NIL's<br><br>I will continue using this code to see if there are additional problems. <br>
<br>BTW, I realize that CLISP is not a preferred platform for speedy computation, but that is what I use<br>on Windows, until SBCL gets officially ported to it. And in addition, it is a nice cross-check on portability.<span><font color="#888888"><br>
<br>Mirko<br><br><br>
</font></span><br></div></div>_______________________________________________<br>
GSLL-devel mailing list<br>
<a href="mailto:GSLL-devel@common-lisp.net" target="_blank">GSLL-devel@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>