Skip to content

Commit

Permalink
rename isBeliefBelieved to isStillBelieved
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Sep 17, 2024
1 parent 2032388 commit 948c88e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
rename `isBeliefBelieved` to `isStillBelieved`
extract `beliefMergeMany`

# 4.4 Dependencies Improve Search
Expand Down
4 changes: 2 additions & 2 deletions src/belief-system/beliefMergeManyStillBelieved.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Belief } from "../belief/Belief.js"
import { merge } from "../merge/merge.js"
import { type Nothing, nothing } from "../nothing/Nothing.js"
import { isBeliefBelieved } from "./isBeliefBelieved.js"
import { isStillBelieved } from "./isStillBelieved.js"

// The procedure `strongest` finds the most informative consequence
// of the current worldview. It does this by using merge to combine
Expand All @@ -12,7 +12,7 @@ import { isBeliefBelieved } from "./isBeliefBelieved.js"
export function beliefMergeManyStillBelieved<A>(
beliefs: Array<Belief<A>>,
): Belief<A> | Nothing {
const stillBelievedBeliefs = beliefs.filter(isBeliefBelieved)
const stillBelievedBeliefs = beliefs.filter(isStillBelieved)
return stillBelievedBeliefs.reduce(
(result, belief) => merge(result, belief),
nothing,
Expand Down
2 changes: 1 addition & 1 deletion src/belief-system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from "./BeliefSystem.js"
export * from "./beliefSystemEqual.js"
export * from "./beliefSystemMerge.js"
export * from "./beliefSystemQuery.js"
export * from "./isBeliefBelieved.js"
export * from "./isStillBelieved.js"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Belief } from "../belief/index.js"
import { type Reason, type Reasons } from "../reason/index.js"
import { scheduleAllEverScheduledPropagators } from "../scheduler/index.js"

export function isBeliefBelieved<A>(belief: Belief<A>): boolean {
export function isStillBelieved<A>(belief: Belief<A>): boolean {
return Array.from(belief.reasons).every(isReasonBelieved)
}

Expand Down

0 comments on commit 948c88e

Please sign in to comment.