mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
parent
5f92538a69
commit
da198da133
2 changed files with 6 additions and 6 deletions
|
@ -11,8 +11,8 @@ export function countIf<T>(f: Predicate<T>, xs: T[]): number {
|
|||
/**
|
||||
* Count the number of elements that is equal to the element
|
||||
*/
|
||||
export function count<T>(x: T, xs: T[]): number {
|
||||
return countIf(y => x === y, xs);
|
||||
export function count<T>(a: T, xs: T[]): number {
|
||||
return countIf(x => x === a, xs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,8 +33,8 @@ export function intersperse<T>(sep: T, xs: T[]): T[] {
|
|||
/**
|
||||
* Returns the array of elements that is not equal to the element
|
||||
*/
|
||||
export function erase<T>(x: T, xs: T[]): T[] {
|
||||
return xs.filter(y => x !== y);
|
||||
export function erase<T>(a: T, xs: T[]): T[] {
|
||||
return xs.filter(x => x !== a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export type Predicate<T> = (x: T) => boolean;
|
||||
export type Predicate<T> = (a: T) => boolean;
|
||||
|
||||
export type Relation<T, U> = (x: T, y: U) => boolean;
|
||||
export type Relation<T, U> = (a: T, b: U) => boolean;
|
||||
|
||||
export type EndoRelation<T> = Relation<T, T>;
|
||||
|
|
Loading…
Reference in a new issue