-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[keep it simple] do not inject merge to cell -- just use the global m…
…erge - 也许用多线程的 C 实现时,cell 才应该有自己的局部 merge 函数
- Loading branch information
Showing
2 changed files
with
3 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
import { merge } from "../merge/index.js" | ||
import type { Propagator } from "../propagator/index.js" | ||
import { nothing, type Nothing } from "./Nothing.js" | ||
|
||
export type Merge<T> = (content: T | Nothing, increment: any) => T | Nothing | ||
|
||
export type Cell<T> = { | ||
"@type": "Cell" | ||
content: T | Nothing | ||
propagators: Array<Propagator> | ||
merge: Merge<T> | ||
} | ||
|
||
export function Cell<T>( | ||
content?: T, | ||
options: { | ||
merge: Merge<T> | ||
} = { | ||
merge, | ||
}, | ||
): Cell<T> { | ||
export function Cell<T>(content?: T): Cell<T> { | ||
return { | ||
"@type": "Cell", | ||
content: content || nothing, | ||
propagators: [], | ||
merge: options.merge, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters