[Antik-devel] Bug in antik/.../sample/low-discrepancy-sequence.lisp ?

Mirko Vukovic mirko.vukovic at gmail.com
Sat Dec 8 15:59:52 UTC 2012


Hello,

this is on clisp 2.48 on cygwin.

The function low-discrepancy-sample could not compile because iterate could
not digest loop

*****
Iterate, in clause (COLLECT
 (APPLY MAKE-FUNCTION
  (APPEND FIXED-PARAMETERS
   (MAPCAN
    (LAMBDA (X SEQ)
     (LIST (FIRST X) (VAL-FROM-RANGE (GREF V SEQ) (SECOND X) (THIRD X))))
    SWEEP-PARAMETERS
    (LOOP FOR I FROM 0 BELOW (LENGTH SWEEP-PARAMETERS) COLLECT I))))):
Iterate does not know how to handle the special form (MACROLET
 ((LOOP-FINISH NIL (SYSTEM::LOOP-FINISH-ERROR)))
 (BLOCK NIL
  (LET ((I 0) (#:LIMIT-273656 (LENGTH SWEEP-PARAMETERS)))
   (PROGN
    (LET ((#:ACCULIST-VAR-273657 NIL))
     (MACROLET ((LOOP-FINISH NIL '(GO SYSTEM::END-LOOP)))
      (TAGBODY SYSTEM::BEGIN-LOOP
       (WHEN (COMMON-LISP:>= I #:LIMIT-273656) (LOOP-FINISH))
       (PROGN (SETQ #:ACCULIST-VAR-273657 (CONS I #:ACCULIST-VAR-273657)))
       (PSETQ I (COMMON-LISP:+ I 1)) (GO SYSTEM::BEGIN-LOOP)
SYSTEM::END-LOOP
       (MACROLET
        ((LOOP-FINISH NIL (SYSTEM::LOOP-FINISH-WARN) '(GO
SYSTEM::END-LOOP)))
        (RETURN-FROM NIL (SYSTEM::LIST-NREVERSE
#:ACCULIST-VAR-273657))))))))))
It will not be walked, which means that Iterate clauses inside it will not
be seen.
*****

If I replaced the loop form with the much more verbose

(let (res)
           (dotimes (i (length sweep-parameters) (nreverse res))
         (push i res)))

the code compiled cleanly.

The same error can be seen with a much simpler:
(iter:iter
       (iter:for v iter:in '(1 2 3 4))
       (iter:collect (loop for i in v)))

Another alternative is to use iter instead of loop

(iter:iter
           (iter:for i from 0 below (length sweep-parameters))
           (iter:collect i))

It compiles cleanly, but I did not test the function accuracy.

Mirko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/antik-devel/attachments/20121208/3a0b43b6/attachment.html>


More information about the antik-devel mailing list