next up previous contents index
suivant: Test if a value monter: Lists and vectors précédent: Select the elements of   Table des matières   Index


Remove elements of a list : remove

remove takes as argument : a boolean function f and a list L.
remove removes in the list L, the elements c such that f(c)==true.
Input :
remove(x->(x>=2),[0,1,2,3,1,5])
Output :
[0,1,1]
Remark The same applies on strings, for example, to remove all the "a" of a string:
Input :
ord("a")
Output :
97
Input :
f(chn):={
  local l:=length(chn)-1;
  return remove(x->(ord(x)==97),seq(chn[k],k,0,l));
}
Then, input :
f("abracadabra")
Output :
["b","r","c","d","b","r"]
To get a string, input :
char(ord(["b","r","c","d","b","r"])
Output :
"brcdbr"



giac documentation written by Renée De Graeve and Bernard Parisse