emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add new lisp function length= with bytecode support


From: Gdobbins
Subject: Re: [PATCH] Add new lisp function length= with bytecode support
Date: Mon, 06 Mar 2017 15:36:59 -0500

> Why add length= as a primitive? Why is it important enough to justify that?

About 14% of all calls to length are then simply compared via =. I checked and the < and > variants combined account for about 30%, the <= and >= combined about 10%. I don't really see a purpose in using nthcdr like you have in a lisp implementation of length=, it isn't any better than just using length directly since it requires just as much linked list traversal. That was of course the reason I implemented it in C.

> Wouldn't it make sense to have a function ‘length<’ and ‘length>’ as well?

Yes, it would appear so. But for the same reasons as length= they would need to be implemented in C for there to be any improvement in efficiency. They could be added to the < and > bytecodes in the same way that I've done with = and length=.

-- Graham Dobbins


reply via email to

[Prev in Thread] Current Thread [Next in Thread]