Improve MFM bracket matching
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
parent
be0cb88b6c
commit
580191fb17
3 changed files with 115 additions and 28 deletions
|
@ -109,3 +109,9 @@ export function takeWhile<T>(f: Predicate<T>, xs: T[]): T[] {
|
|||
}
|
||||
return ys;
|
||||
}
|
||||
|
||||
export function cumulativeSum(xs: number[]): number[] {
|
||||
const ys = Array.from(xs); // deep copy
|
||||
for (let i = 1; i < ys.length; i++) ys[i] += ys[i - 1];
|
||||
return ys;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue