Max Alekseyev on Thu, 09 May 2024 18:18:03 +0200


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

Re: apply / select are inconsistent on Maps


Hi Karim,

But why not extend the functionality of select() to Maps, just making it consistent with how apply() works?

Regards,
Max

On Thu, May 9, 2024 at 11:26 AM Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> wrote:
Hi Max,

* Max Alekseyev [2024-05-09 16:39]:
> Hello,
> The following example shows that
> (i) apply() and select() disagree on what is argument of the function when
> applied to Map; and
> (ii) select() produces List rather than Map as a result.

Undefined behavior: select() is not documented to apply to maps.
(In fact, it somehow applies because maps are internally implemented as
t_LISTs.)

select should just throw an exception on this input.

Cheers,

    K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/