Arc Forumnew | comments | leaders | submitlogin
4 points by palsecam 5772 days ago | link | parent

Thaddeus, with your fix I get:

   arc> (noisy-each 4 x "1234" (pr x))
   1234
   t
Shouldn't it have a dot at the end? 'pr is called 4 times. You said:

  (noisy-each 4 x "12341234" (pr x))
  should return: 1234.1234
  correct?
I would say it should print "1234.1234." actually.

But anyway, "123.4123" appears as a bug for me too.

The "problem" is that ,@body is executed after the 'when clause that prints (or not) a dot. In the case of 'pr, the order actually makes a difference.

A fix. Inverse 'when and ,@body in the 'each instruction:

   (each ,var ,val
     ,@body
     (when (multiple (++ ,gc) ,gn)
       (pr ".") 
       (flushout)))

Result:

   arc> (noisy-each 4 x "12341234" (pr x))
   1234.1234.  ; this I think is correct
   t


2 points by thaddeus 5772 days ago | link

Agreed - thnx. I was hacking noisy-each to do an intersperse equivalent for a function I am writing -should have stuck to the macro at hand :) T.

-----

1 point by palsecam 5772 days ago | link

Hihi thanks I was going to ask you what you were doing when spotting this bug!

-----