[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lengths and stuff
From: |
Jean Louis |
Subject: |
Re: lengths and stuff |
Date: |
Mon, 28 Dec 2020 10:15:11 +0300 |
User-agent: |
Mutt/2.0 (3d08634) (2020-11-07) |
* Tomas Hlavaty <tom@logand.com> [2020-12-27 23:53]:
> On Sun 27 Dec 2020 at 10:52, Drew Adams <drew.adams@oracle.com> wrote:
> >> Using length in a predicate is yet completely different and most
> >> likely bad because to answer the predicate, traversing the whole list
> >> is wasted time and energy.
> >
> > (lambda (xs) (= (length xs) 25)) ; need to count elts
>
> Is that a joke?
>
> The predicates were proposed to help programers avoid writing such bad
> code. And if somebody writes such bad code, it is almost trivial to fix
> it with search and replace:
>
> "(= (length" -> "(length="
> "(< (length" -> "(length<"
> "(> (length" -> "(length>"
> "(/= (length" -> "(length/="
> "(<= (length" -> "(length<="
> "(>= (length" -> "(length>="
>
> Also the "symmetry" (or exhaustiveness?) here is to assist in easily
> fixing bad code with minimum changes.
>
> Nothing of course helps to those who are determined to unneccessarily
> count _all_ the elements of lists.
May I understand if that proposal is to implement it in C or in Lisp?
Does that mean when (length< list-1 10) is implemented in C it would
become faster than: (< (length list-1) 10) ?
Or is that proposal to make Lisp functions like:
(defun length< (list n)
(when (< (length list) n)
t))
- Re: Internationalize Emacs's messages (swahili), (continued)
- Re: Internationalize Emacs's messages (swahili), Jean Louis, 2020/12/28
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/26
- RE: Internationalize Emacs's messages (swahili), Drew Adams, 2020/12/26
- lengths and stuff, Daniel Brooks, 2020/12/26
- RE: lengths and stuff, Drew Adams, 2020/12/27
- RE: lengths and stuff, Tomas Hlavaty, 2020/12/27
- RE: lengths and stuff, Drew Adams, 2020/12/27
- RE: lengths and stuff, Tomas Hlavaty, 2020/12/27
- Re: lengths and stuff,
Jean Louis <=
- Re: lengths and stuff, Eric Abrahamsen, 2020/12/28
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Richard Stallman, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Daniel Brooks, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Daniel Brooks, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Daniel Brooks, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Werner LEMBERG, 2020/12/26