Waldek Hebisch <hebi...@math.uni.wroc.pl> writes: | Serge D. Mechveliani wrote: | > | > On Sun, Feb 05, 2012 at 01:56:20AM +0100, Ralf Hemmecke wrote: | > > On 02/04/2012 06:13 PM, Serge D. Mechveliani wrote: | > >> [..] | > >>>> dropWhile(p: Character -> Boolean, xs: List Character) : | > >>>> List Character == | > >>>> empty? xs => xs | > >>>> p first(xs) => dropWhile(p, rest xs) | > >>>> xs | > >>>> Is this more efficient?
[...] | Spad compiler will inline "simple enough" functions. Unfortunately, | currently this means functions consisting of single operation. | | Your version will generate the following Lisp code: | | (DEFUN |TTT;dropWhile;M2L;1| (|p| |xs| $) | (COND ((OR (NULL |xs|) (NULL (SPADCALL (|SPADfirst| |xs|) |p|))) |xs|) | ('T (SPADCALL |p| (CDR |xs|) (QREFELT $ 8))))) OpenAxiom resolves these SPADCALLs within the same package/domain and produces (DEFUN |SERGEI;dropWhile;M2L;1| (|p| |xs| $) (COND ((OR (NULL |xs|) (NOT (SPADCALL (|SPADfirst| |xs|) |p|))) |xs|) (T (|SERGEI;dropWhile;M2L;1| |p| (CDR |xs|) $)))) which any of the free Lisp supported by OpenAxiom is capable of recognizing as tail-recursive, and therefore optimize appropriately. -- Gaby ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel