[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add cl-map-into, revision 2
From: |
akater |
Subject: |
Re: [PATCH] Add cl-map-into, revision 2 |
Date: |
Thu, 07 Oct 2021 08:24:32 +0000 |
Eli Zaretskii <eliz@gnu.org> writes:
> Is there any reasons you excluded other kinds of sequences (strings
> and bool-vectors)?
I forgot strings aren't vectors in Elisp (I rarely deal with vectors).
Both strings and bool-vectors are arrays so I could simply replace
vector with array wherever it matters. This would include char-tables
too; I don't have experience with those.
But it is conceivale that Elisp might get arrays that are not sequences
in the future. E.g. CL has multidimensional arrays. Elisp manual
mentions “all [currently defind types of array are] one-dimensional” so
the notion of multidimensional array is recognised already.
It thus would be nice to have a special type for one-dimensional array.
In CL, it's precisely “vector”.
Anyway, I don't hope this type will appear soon so for the time being
I'll just replace “vector” with “array”.
>> + (should (equal [42 42 42]
>> + (let ((s (vector 18 19 20)))
>> + (cl-map-into s #'+ s '(6 4 2 1 not-even-a-number) s)
>> + s))))
>> +
>
> I don't see here any tests where the lengths of the sequences are
> different. Can you add some of those?
Lengths are different in the last test.
But it reminded me that I should add an example with a circular list.
After all, this is the case where current implementations of cl-
mappers break (for 3 arguments and beyond).
signature.asc
Description: PGP signature