[Top][All Lists]

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

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

From: Paul Eggert
Subject: Re: [PATCH] Add new lisp function length= with bytecode support
Date: Mon, 27 Feb 2017 15:06:31 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/27/2017 10:43 AM, Gdobbins wrote:
I looked in the manual for a place where length= should be documented, but didn't find one. I thought the docstring was sufficient. Perhaps I was mistaken.

It should be documented in doc/lispref/sequences.texi, no?

As the intended use of length= is to compare lengths, it's confusing that it also accepts markers and floats, plus that makes the implementation a bit slower as it can't use EQ to compare lengths. It would be cleaner and simpler for length= to accept only sequences and integers, as Alexandria does.

I assume that markers and floats were put in only so that the byte-compiler could optimize expressions like (= (length FOO) BAR) without worrying about incompatibilities in the very-unlikely case where BAR is a float or a marker. In that case, perhaps the the byte-compiler should use a specialized length= function that is not visible to the user, so that the user-visible function (if any) can be kept cleaner.

reply via email to

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