loop conformance

Steve Haflich shaflich at gmail.com
Wed Jan 29 01:03:07 UTC 2014


I'm in a grumpy mood today, so I decided to take out my frustrations on the
ANS for CL, or implementations thereof.  Consider carefully what the
following form should return:

(let ((v (make-array 10
    :initial-contents '(0 1 2 3 4 5 6 7 8 9)
    :fill-pointer 5)))
  (loop for x across v
      when (eql x 2) do (incf (fill-pointer v))
      collect x))

ACL and SBCL both return (0 1 2 3 4).  Probably every other implementation
does too.  I believe the ANS requires the return to be (0 1 2 3 4 5),
although the definition in *6.1.2.1.5 The for-as-across subclause* uses
various undefined terminology.  (We of X3J13 understood that the loop
specification was not our best work.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20140128/cb1edb67/attachment.html>


More information about the pro mailing list