[LispM] odd Explorer behavior - interpreted vs. compiled

Brad Parker brad at heeltoe.com
Wed Oct 12 19:30:45 PDT 2016


On 10/12/16 9:42 PM, r.stricklin wrote:
> Howdy, folks.
>
> I have an odd issue I'm at a loss to explain and lack insight re: where to start troubleshooting.
>
> I have a function which is meant to take a number and a list of numbers as arguments, and return T if the number is evenly divisible by any number in the list. Nil, if the number is not evenly divisible by any of the numbers in the list.
>
> (defun divp (n list)
>    (block nil (mapcar #'(lambda (p)
>                     (cond ((zerop (mod n p)) (return T)))) list)
>                 (return nil)))
>
>
> This works exactly as I expect, whether compiled or interpreted, on Allegro CL and in Genera 8. On the microExplorer (Release 6.1 if it matters), it works exactly as I expect... until I compile it. Once it's compiled, it always returns nil.
>
If it were me, I'd disassemble the compiled function on genera 8 and the 
explorer.  And, just for grins I'd disassemble it on the CADR as well.  
I would think the CADR compiler and the explorer compiler are pretty 
similar (I'd like to think they had common ancestry but I don't know how 
much LMI did before TI got to it)

I guess it sounds like a bug to me.  I would think the macro code would 
show it.   The return inside the lambda might be an issue.  I might fool 
around with the lambda to return a count or value instead of returning 
and see if that works when compiled.

it does seem odd.

-brad



More information about the LispM mailing list