List Info

Thread: Bug?




Bug?
user name
2006-05-09 15:33:33
Hello,

the following works when interpreted, but gives an error
when compiled
(CMUCL 19c from Debian/testing):

(defun test (string)
  (loop for pos below (length string) do
        (setq pos (position #\- string))
              (unless pos (return nil))))

(test "Hi")

Is this allowed or a bug?

Thanks, Nicolas.


Bug?
user name
2006-05-09 16:14:46
>>>>> "Nicolas" == Nicolas Neuss
<Nicolas.NeussIWR.Uni-Heidelberg.De> writes:

    Nicolas> Hello,

    Nicolas> the following works when interpreted, but
gives an error when compiled
    Nicolas> (CMUCL 19c from Debian/testing):

    Nicolas> (defun test (string)
    Nicolas>   (loop for pos below (length string) do
    Nicolas>         (setq pos (position #\- string))
    Nicolas>               (unless pos (return nil))))

    Nicolas> (test "Hi")

    Nicolas> Is this allowed or a bug?

Don't know if it's allowed or a bug, but I can tell you
why the
compiler version gives an error.  The loop macro declares
POS to be a
NUMBER, and you're binding NIL to POS, when POSITION
returns NIL.

Ray


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )