[Top][All Lists]

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

Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ..

From: Alex Gramiak
Subject: Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...})
Date: Sat, 20 Apr 2019 19:52:36 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Alex Gramiak <address@hidden>
>> Cc: address@hidden
>> Date: Sat, 20 Apr 2019 12:18:01 -0600
>> Ideally. Though in the case of vector-partition the size of the 2
>> partition vectors is not known in advance, so a Lisp implementation
>> would have to create two extra Lisp vectors as opposed to using
>> SAFE_ALLOCA. That is, unless Elisp grows a growable/resizeable vector
>> type (which is something I was thinking about -- would that be denied?).
> What would be the advantage of that vs lists?

Better space efficiency, less pressure (hopefully) on the GC, and faster
random access. I believe growable vectors would make sense for linear
lists that don't need the insertion/deletion properties of linked lists.

As for vector-partition, it's more so a means of keeping the input and
partition types the same. Not a huge deal.

> Vectors are used quite rarely in Emacs Lisp, IME.

Not enough suitable vector procedures doesn't help, though. Emacs Lisp
is certainly not a general-purpose language, but that doesn't mean that
it has to be missing particular language features/types that improve
efficiency as long as it doesn't add a lot of complexity.

> Every additional primitive means a burden.  More importantly, we
> should IMO be consistent in how we design and implement families of
> functions, which is why I still think we should extend seq.el
> (possibly some of that with internal C primitives, if needed), instead
> of starting a new family.

I'm not sure what you mean here by internal C primitives if it's not
similar to vector-memq/member. Do you just mean expose a single
`sequence-memq' and keep the new type-specific implementations internal?

reply via email to

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