<html><head></head><body><div class="ydp276477e6yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div dir="ltr" data-setdir="false">Okay, having a specialised representation for positive integers makes sense as a further specialisation of INTEGER. I wish this was documented somewhere, a 1 minute google search did not turn up anything.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I still have the problem of ensuring that the parameters to a function, a sequence and a number, are all of the same type so I can dispatch on specialised (typed declared) versions of loop. At the moment I have:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><div><font face="lucida console, sans-serif"> (assert (and (plusp (length coefficients))<br> (every (lambda (elt)<br> (typep elt (type-of x)))<br> coefficients)))</font></div><div><br></div><div dir="ltr" data-setdir="false">which works fine for single-float and double-float, but fails if any of the coefficients are negative because their type-of is FIXNUM whilst the X or other coefficients may be <font face="courier new, courier, monaco, monospace, sans-serif"><span>(INTEGER 0 4611686018427387903)</span></font></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span><br></span></font></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><span>Any ideas?</span><br></font></div></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><br></font></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><br></font></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><br></font></div><div dir="ltr" data-setdir="false"><font face="Helvetica Neue, Helvetica, Arial, sans-serif"><br></font></div><div><br></div>
</div><div id="yahoo_quoted_2039831018" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Thursday, October 24, 2019, 3:24:56 PM GMT+8, Daniel Kochmański <daniel@turtleware.eu> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr"><br clear="none">> CCL (1.11) has most-positive-fixnum of 1152921504606846975SBCL (1.5.6) has 4611686018427387903<br clear="none">><br clear="none">> However:<br clear="none">> CL-USER> (subtypep 'fixnum 'integer)<br clear="none">> T<br clear="none">> T<br clear="none">> CL-USER><br clear="none">><br clear="none">> so FIXNUM is a subtype of INTEGER, and it should be the type returned if the implementation is following the CltL2 guidelines if I'm understanding the type system correctly.<br clear="none"><br clear="none">CLtL2 has been superseded by ANSI specification so it is not<br clear="none">bounding. Anyway, more specific type here is<br clear="none"><br clear="none"> (integer 0 #.most-positive-fixnum)<br clear="none"><br clear="none">Try (subtypep (integer 0 #.most-positive-fixnum) 'fixnum) and it will<br clear="none">yield true as well.<br clear="none"><br clear="none">The reason why you have result 'fixnum for negative and '(integer 0<br clear="none">#.most-positive-fixnum) for positive integers is probably because CCL<br clear="none">(and other implementations in fact) have a specialized representation<br clear="none">for unsinged fixnums (similar to i.e 'unsigned int' in C).<div class="yqt3561871698" id="yqtfd78486"><br clear="none"><br clear="none">Daniel<br clear="none"><br clear="none">--<br clear="none">Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland<br clear="none">TurtleWare - Daniel Kochmański | www.turtleware.eu<br clear="none"><br clear="none">"Be the change that you wish to see in the world." - Mahatma Gandhi</div></div></div>
</div>
</div></body></html>