From: Juanma Barranquero

Subject: Re: loop variable of type real

Date: 1999-5-4 6:16

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03 May 1999 17:04:39 UT, Erik Naggum wrote:

> (INTEGER 0 10) is actually a very specific subtype of FIXNUM.
Yes, you're right, of course.
> try (setq excl::*loop-real-data-type* 'fixnum) and see if you win.
Yes, that works for fixnum loop counters (as is the case in "repeat" loops). Thanks.
> if you have ACL 5.0, the sources for LOOP macro should be in > #p"sys:src;loop.cl", or in #p"sys:src;cl;code;loop.cl" if you > have signed the support agreement with limited source code.
Yes, I've looked into it. What I find surprising is that I'd suppose (loop for i from 1 to n do...) or (loop repeat n do...) with a (fixnum-sized) integer "n" are a lot more usual than (loop for i from 1.0 to 10.0 do...) or (loop repeat 10.0 do...) or similar. So I would've expected for the loop macro to detect if it's using statically defined fixnum constants and act as appropriate. With "dotimes" we get: USER(14): :ma (dotimes (i 10.0) (do-something)) (LET ((#:G116 10.0) (I 0)) (DECLARE) (BLOCK NIL (TAGBODY #:|Tag22| (COND ((>= I #:G116) (RETURN-FROM NIL (PROGN)))) (TAGBODY (DO-SOMETHING)) (PSETQ I (1+ I)) (GO #:|Tag22|)))) USER(15): :ma (dotimes (i 10) (do-something)) (LET ((I 0)) (DECLARE (TYPE (INTEGER 0 10) I)) (BLOCK NIL (TAGBODY #:|Tag23| (COND ((>= I 10) (RETURN-FROM NIL (PROGN)))) (TAGBODY (DO-SOMETHING)) (PSETQ I (1+ I)) (GO #:|Tag23|)))) which at least seems more logical. /L/e/k/t/u -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.0.2i iQA/AwUBNy660f4C0a0jUw5YEQLL4wCg5Y2Y0R6N+wBTk1pfFyxkJl2Xej4AnRJy ngAV8B9Nh8wQbh8EvF6ko0Xh =5JMV -----END PGP SIGNATURE-----