Barry Margolin
7/28/2015 2:29:00 PM
In article <87h9ooigz2.fsf@zpob.site.sys>, Zach Beane <xach@xach.com>
wrote:
> Jim Newton <jimka.issy@gmail.com> writes:
>
> > sbcl issues some warnings compiling this code.
> > Does anyone see what's happening here?
> >
> >
> > (defun median-pick (list)
> > "Pick the median value in a LIST."
> > (nth (round (/ (length list) 2)) list))
> >
> >
> >
> > ------ *slime-compilation* ------------
> >
> > cd ~/
> > 1 compiler notes:
> >
> > sw/climb/src/algorithm/median.lisp:30:3:
> > note:
> > deleting unreachable code
> > --> CAR NTHCDR BLOCK FLET TYPECASE LET COND IF COND THE PROGN DO BLOCK
> > --> LET
> > ==>
> > LIST
> >
>
> I don't get that note with the latest sbcl. Is there anything else in
> median.lisp? What version of SBCL are you using? Maybe the note is in
> error and a new version fixed it.
The only issue I can see with that code is that
(round (/ <expr> 2))
can be written as
(round <expr> 2)
But I would just expect a good compiler to optimize one into the other,
not warn about it.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***