From: Raymond W. <rw...@gm...> - 2017-10-17 11:11:48
|
(car nil) -> nil, so that's not it. On the other hand, nil is not a number, so (maybe) one might expect an error to be thrown before the (cond ...). On Tue, Oct 17, 2017 at 12:49 PM, Will Mengarini <se...@es...> wrote: > * Jim Newton <jim...@gm...> [17-10/17=Tu 08:29 +0200]: > >> If B is a number, then A cannot be NIL. Right? > >> > >> (defun test-me (a &aux (b (car a))) > >> (declare (type list a) > >> (type number b)) > >> (cond ((null a) > >> (format t "line unreachable")) > >> ((> 0 b) > >> b))) > > * Stelian Ionescu <sio...@cd...> [17-10/17=Tu 12:10 +0200]: > > Looks like you want type CONS. > > His point is not that type LIST doesn't exclude NIL; that's > deliberate. Instead, he's suggesting that because B is > initialized from (CAR A), A must /have/ a CAR, therefore > not be NIL; and the type inference should notice this. > > -- > Will Mengarini <se...@es...> > Free software: the Source will be with you, always. > Any sufficiently advanced stupidity is indistinguishable from malice. > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel > |