Skip to content

Commit

Permalink
conceptFromEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jul 3, 2024
1 parent 63db733 commit 9557b38
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
5 changes: 1 addition & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

# concept

`conceptFromEntities` -- 构造 immutable 的 `Concept`
`conceptFromAttributes` -- 构造 immutable 的 `Concept`
`conceptFromEntity` -- 构造 immutable 的 `Concept` -- 有更好的名字吗?
`conceptFromAttribute` -- 构造 immutable 的 `Concept` -- 有更好的名字吗?
`conceptFromAttributes`

# context

Expand Down
Empty file.
23 changes: 23 additions & 0 deletions src/concept/conceptFromEntities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
commonAttributes,
commonEntities,
type Context,
type Entity,
} from "../context/index.js"
import type { Concept } from "./Concept.js"

export function conceptFromEntities(
context: Context,
entities: ReadonlySet<Entity> | ReadonlyArray<Entity>,
): Concept {
entities = new Set(entities)

const intent = commonAttributes(context, entities)
const extent = commonEntities(context, intent)

return {
context,
extent,
intent,
}
}
2 changes: 2 additions & 0 deletions src/concept/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export * from "./closureAttributes.js"
export * from "./closureEntities.js"
export * from "./Concept.js"
export * from "./conceptFromAttributes.js"
export * from "./conceptFromEntities.js"
export * from "./isExtent.js"
export * from "./isIntent.js"

0 comments on commit 9557b38

Please sign in to comment.