Skip to content

Commit

Permalink
assimilateBeliefSystem & beliefSystemMerge -- 简化类型参数
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Oct 5, 2024
1 parent 3e96b7b commit 5ab2000
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/belief-system/assimilateBeliefSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type { BeliefSystem } from "./BeliefSystem.js"
// one, into the given belief system with no deduction of
// consequences.

export function assimilateBeliefSystem<A, B>(
export function assimilateBeliefSystem<A>(
base: BeliefSystem<A>,
target: BeliefSystem<B>,
): BeliefSystem<A | B> {
return target.beliefs.reduce<BeliefSystem<A | B>>(
target: BeliefSystem<A>,
): BeliefSystem<A> {
return target.beliefs.reduce<BeliefSystem<A>>(
(result, belief) => assimilateBelief(result, belief),
base,
)
Expand Down
7 changes: 4 additions & 3 deletions src/belief-system/beliefSystemMerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { BeliefSystem } from "./BeliefSystem.js"
// current one, and then deduce only those consequences that are
// relevant to the current worldview.

export function beliefSystemMerge<A, B>(
export function beliefSystemMerge<A>(
content: BeliefSystem<A>,
increment: BeliefSystem<B>,
): BeliefSystem<A | B> | Contradiction {
increment: BeliefSystem<A>,
): BeliefSystem<A> | Contradiction {
const candidate = assimilateBeliefSystem(content, increment)
const consequence = beliefMergeManyStillBelieved(candidate.beliefs)
// checkConsistent(consequence)
return assimilateBelief(candidate, consequence)
}

0 comments on commit 5ab2000

Please sign in to comment.