Bill Allombert on Mon, 20 May 2024 19:04:30 +0200


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

Re: apply / select are inconsistent on Maps


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