# Question:How to search and remove elements in a list of variable size?

## Question:How to search and remove elements in a list of variable size?

Maple 2017

Hello

Unfortunately I run out of ideas on how to solve the problem of searching and removing elements in a variable size list.  Below you can find an example.

```parms:=[seq(seq(alpha[i,j],j=0..9),i=1..3)];
abc:=combinat:-choose(parms,3):```

the condition to remove the element of the list is given by the following procedure.

```conds:= proc(varCoef::list,vars::name:=alpha)
local T1,T2,res;
#
T1 := table([2=3,3=2,5=6,6=5,7=9,9=7]):
T2 := table([2=3,3=2]):
#
res:=map(u->vars[`if`(assigned(T2[op(1,u)]),T2[op(1,u)],op(1,u)),
`if`(assigned(T1[op(2,u)]),T1[op(2,u)],op(2,u))],
varCoef);
res:=convert(convert(res,set),list):
end proc:```

Something like

`member(conds(abc[1]),abc,'k')`

if it is a member, the element indexed by k should be removed from abc and then the search continues using the next element in abc (that now has one less element).   Otherwise, the element is kept and the search moves to next one.  The process ends when the last element in a short version of abc is tested.

Thanks all for the help and patience.

Ed

﻿