Max Alekseyev on Mon, 20 May 2024 20:10:49 +0200


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

Re: apply / select are inconsistent on Maps


Hi Bill,

Thank you for the effort!
When you say the list of keys - what is the order of those keys? Are they sorted?

Regards,
Max

On Mon, May 20, 2024 at 1:04 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
On Thu, May 09, 2024 at 12:17:18PM -0400, Max Alekseyev wrote:
> Hi Karim,
>
> But why not extend the functionality of select() to Maps, just making it
> consistent with how apply() works?

OK I have implemented select for t_MAP.
If flag=0, it returns a MAP if flag=1, it returns the list of keys.

M=Map([1,2;3,4;5,6]);
select(x->x%4==2,M)
%2 = Map([1,2;5,6])
select(x->x%4==2,M,1)
%3 = [1,5]~

Cheers,
Bill