Navigation
Synopsis Delete an element from a list.
Function list[&T] delete(list[&T] lst, int n)
Usage import List;
Description Delete the n-th element from a list. A new list without the n-th element is returned as result. The IndexOutOfBounds exception is thrown when n is not a valid index.
Examples
rascal>import List;
ok
rascal>delete([1, 2, 3], 1);
list[int]: [1,3]
rascal>delete(["zebra", "elephant", "snake", "owl"], 2);
list[str]: ["zebra","elephant","owl"]

Questions
Question [1]. When you delete an element from a list, the number of elements:




Question [2].
The type of delete([true, false, true, true, false], 1) is

Question [3].
delete(["Lemon", "Elmo", "Boba Fett", "Cayenne", "Lemon", "Emperor Palpatine"], 1) == 



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.