Add erase function (#2641)
This commit is contained in:
parent
3cace734c7
commit
00d79487cd
11 changed files with 31 additions and 19 deletions
|
@ -13,3 +13,7 @@ export function concat<T>(xss: T[][]): T[] {
|
|||
export function intersperse<T>(sep: T, xs: T[]): T[] {
|
||||
return concat(xs.map(x => [sep, x])).slice(1);
|
||||
}
|
||||
|
||||
export function erase<T>(x: T, xs: T[]): T[] {
|
||||
return xs.filter(y => x !== y);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue