[LispM] odd Explorer behavior - interpreted vs. compiled

Raymond Wiker rwiker at gmail.com
Thu Oct 13 01:33:36 PDT 2016


Could it be that the compiler inserts a block named nil when it compiles
the expression?

On Thu, Oct 13, 2016 at 7:09 AM, r.stricklin <bear at typewritten.org> wrote:

>
> On Oct 12, 2016, at 8:00 PM, r.stricklin wrote:
>
> >> 10 BR         28            ; here is the bug.
> >
> > boy, I wish I could haul this one back. talk about jumping to
> conclusions! yikes.
>
> Okay, it's something to do with the semantics of the defun macro and
> interaction with return.
>
> This works, using "return-from divp" instead of just "return":
>
> > (defun divp (n list) (block nil (mapcar #'(lambda (p) (cond ((zerop (mod
> n p)) (return-from divp t)))) list) (return-from divp nil)))
> DIVP
> > (divp 6 '(2 3))
> T
> > (divp 5 '(2 3))
> NIL
> > (compile 'divp)
> DIVP
> 0
> > (divp 6 '(2 3))
> T
> > (divp 5 '(2 3))
> NIL
> > (uncompile 'divp)
> T
> > (fdefinition 'divp)
> (NAMED-LAMBDA DIVP (N LIST) (BLOCK DIVP (BLOCK NIL (MAPCAR (FUNCTION
> (LAMBDA (P) (COND ((ZEROP (MOD N P)) (RETURN-FROM DIVP T))))) LIST)
> (RETURN-FROM DIVP NIL))))
>
> I can't say I really understand _why_ it ought to have mattered. I should
> have a closer look under the covers of one of the other systems.
>
>
> ok
> bear.
>
> --
> until further notice
>
> _______________________________________________
> LispM mailing list
> LispM at tunes.org
> http://lists.tunes.org/mailman/listinfo/lispm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </archives/lispm/attachments/20161013/6d11450d/attachment.html>


More information about the LispM mailing list