[Top][All Lists]

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

RE: Internationalize Emacs's messages (swahili)

From: Drew Adams
Subject: RE: Internationalize Emacs's messages (swahili)
Date: Thu, 31 Dec 2020 21:55:20 -0800 (PST)

> > +DEFUN ("length<", Flength_less, Slength_less, 2, 2, 0,
> I went ahead and pushed this (along with > and =, which seems like a
> natural set).

Is this the set of C-code definitions you implemented?


Let me say at the outset that I'm no expert in C code.

But it looks to me like this might have the problems
I spoke of wrt Lisp implementations that don't handle
dotted or circular lists correctly.  Is that the case?

For circular lists, it looks like you just raise an
error systematically.  To me, that's not as good as
it should be.  The Lisp definitions I provided work
fine for circular lists - their length is greater than
any numeric value, through ` most-positive-fixnum'.
(The function `nthcdr' is well-defined and performant
for a circular-list argument.)

For dotted lists, I cited the fact that simple Lisp
definitions of the `length(<|=|>)' predicates can
raise an error for some inputs and for other inputs
return the same length as if the last cdr were
wrapped in `list'.

IOW, the behavior is inconsistent: no consistent
notification (e.g. error) that the list is dotted;
silent answers as if the list were not dotted, in
~half the cases.

Does your C code have these problems also?

The Lisp definitions I posted don't have these
problems.  They handle circular and dotted lists
fine.  For dotted lists, the length returned is
always the same as what it would be for a proper
list equal to the dotted list but with the last
cdr wrapped in `list'.

I imagine that the same approach I used in Lisp
could be used in C, with no loss in performance
wrt the code you have.  But again, I'm no expert,
especially in C.

In case you missed the Lisp definitions I'm talking
about, they're at the end of this message:


reply via email to

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