From: Stas B. <sta...@gm...> - 2017-02-09 11:05:09
|
Because SBCL is not smart. On Thu, Feb 9, 2017 at 5:50 AM, J. Gareth Williams <ga...@te...> wrote: > Hello, > > I was just curious why SBCL would not be able to recognize and optimize out > the cons, car and cdr calls in this function defintion: > > (declaim (optimize speed (debug 0))) > > (defun foo (a b) > (let ((l (cons a b))) > (+ (car l) (cdr l)))) > > I would have thought it could (would?) be simplified to a simple '+' call, > but it appears it is not. > > Is there simply no optimization available that can detect and simplify this, > or is there a technical or spec-related reason that it can't be done? > > Thanks for any insight, > > Gareth > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Sbcl-help mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-help > -- With best regards, Stas. |