@nakafa/aksara-contracts 8.2.0 → 8.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assessment/document.d.ts +1 -1
- package/dist/assessment/document.js +1 -1
- package/dist/assessment/figure.d.ts +1 -1
- package/dist/assessment/figure.js +1 -1
- package/dist/assessment/fit.d.ts +3 -3
- package/dist/assessment/fit.js +3 -3
- package/dist/assessment/locales.d.ts +1 -1
- package/dist/assessment/scoring.d.ts +1 -1
- package/dist/assessment/scoring.js +1 -1
- package/dist/cache/content.d.ts +1 -1
- package/dist/cache/content.js +1 -1
- package/dist/content.d.ts +3 -2
- package/dist/graph/identity.d.ts +1 -1
- package/dist/graph/identity.js +1 -1
- package/dist/math/boundary.d.ts +9 -0
- package/dist/math/boundary.js +81 -0
- package/dist/math/bounds.d.ts +1 -1
- package/dist/math/collision.d.ts +1 -1
- package/dist/math/coordinate.d.ts +6 -5
- package/dist/math/coordinate.js +2 -2
- package/dist/math/curve.d.ts +1 -0
- package/dist/math/curve.js +4 -2
- package/dist/math/formula/affine.d.ts +22 -0
- package/dist/math/formula/affine.js +79 -0
- package/dist/math/formula/compile.d.ts +1 -1
- package/dist/math/formula/compile.js +1 -1
- package/dist/math/formula/contour.d.ts +1 -1
- package/dist/math/formula/contour.js +28 -13
- package/dist/math/formula/field.js +1 -1
- package/dist/math/formula/mesh.d.ts +1 -1
- package/dist/math/formula/mesh.js +1 -1
- package/dist/math/formula/names.d.ts +1 -1
- package/dist/math/formula/names.js +1 -1
- package/dist/math/formula/parse.d.ts +1 -1
- package/dist/math/formula/parse.js +1 -1
- package/dist/math/formula/plane.d.ts +2 -2
- package/dist/math/formula/plane.js +3 -3
- package/dist/math/formula/reader.d.ts +2 -1
- package/dist/math/formula/reader.js +1 -1
- package/dist/math/formula/region.d.ts +2 -2
- package/dist/math/formula/region.js +3 -3
- package/dist/math/formula/sample.d.ts +1 -1
- package/dist/math/formula/scan.d.ts +1 -1
- package/dist/math/formula/scan.js +1 -1
- package/dist/math/formula/slider.d.ts +2 -2
- package/dist/math/formula/slider.js +1 -1
- package/dist/math/formula/space.d.ts +1 -1
- package/dist/math/formula/space.js +1 -1
- package/dist/math/object.d.ts +12 -0
- package/dist/math/object.js +11 -0
- package/dist/math/plane.d.ts +10 -0
- package/dist/math/plane.js +7 -1
- package/dist/math/precision.d.ts +1 -1
- package/dist/math/precision.js +1 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.d.ts +2 -2
- package/dist/math/space.d.ts +8 -0
- package/dist/math/space.js +5 -1
- package/dist/math/vector.d.ts +1 -1
- package/dist/math/visual.d.ts +239 -212
- package/dist/preview/spec.js +1 -1
- package/dist/program/curriculum.d.ts +1 -1
- package/dist/program/curriculum.js +1 -1
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +2 -2
- package/dist/program/snapshot/hash.d.ts +2 -2
- package/dist/projection/digest.d.ts +1 -1
- package/dist/projection/digest.js +1 -1
- package/dist/projection/hash.js +1 -1
- package/dist/projection/material.d.ts +1 -1
- package/dist/projection/material.js +1 -1
- package/dist/projection/verify.js +1 -1
- package/dist/quran/identity.d.ts +2 -1
- package/dist/quran/provenance.d.ts +2 -2
- package/dist/quran/provenance.js +1 -1
- package/dist/quran/snapshot/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.js +1 -1
- package/dist/quran/snapshot/spec.js +1 -1
- package/dist/quran/source.d.ts +2 -2
- package/dist/release/current/evidence.d.ts +1 -1
- package/dist/release/current/evidence.js +1 -1
- package/dist/release/current/state.d.ts +1 -1
- package/dist/release/current/state.js +1 -1
- package/dist/release/head.js +1 -1
- package/dist/release/items.d.ts +1 -1
- package/dist/release/items.js +1 -1
- package/dist/release/policy.d.ts +1 -1
- package/dist/release/policy.js +1 -1
- package/dist/release/result/digest.d.ts +3 -3
- package/dist/release/result/digest.js +2 -2
- package/dist/release/rollback/digest.d.ts +1 -1
- package/dist/release/rollback/digest.js +1 -1
- package/dist/release/route/digest.d.ts +1 -1
- package/dist/release/route/digest.js +1 -1
- package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
- package/dist/release/snapshot/evidence/assessment.js +1 -1
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/program.js +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.js +1 -1
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -2
- package/dist/release/snapshot/evidence/requirement.js +1 -1
- package/dist/release/snapshot/spec.d.ts +2 -2
- package/dist/release/snapshot/spec.js +1 -1
- package/dist/release/snapshot/verify.d.ts +1 -1
- package/dist/release/snapshot/verify.js +1 -1
- package/dist/release/spec.d.ts +1 -1
- package/dist/release/verify.d.ts +1 -1
- package/dist/release/verify.js +1 -1
- package/dist/renderer/compatibility.d.ts +1 -1
- package/dist/renderer/compatibility.js +2 -2
- package/dist/renderer/contract.d.ts +1 -1
- package/dist/renderer/contract.js +1 -1
- package/dist/runtime/spec.js +2 -2
- package/dist/signature/spec.d.ts +3 -2
- package/dist/signature/verify.d.ts +2 -1
- package/dist/transport/request.d.ts +1 -1
- package/dist/visual/base/math.d.ts +79 -1
- package/dist/visual/base/math.js +31 -3
- package/dist/visual/base/media.d.ts +68 -1
- package/dist/visual/biology/bacteria.d.ts +269 -1
- package/dist/visual/biology/bacteria.js +1 -1
- package/dist/visual/biology/cell.d.ts +202 -1
- package/dist/visual/biology/climate.d.ts +202 -1
- package/dist/visual/biology/climate.js +1 -1
- package/dist/visual/biology/ecology.d.ts +269 -1
- package/dist/visual/biology/physiology.d.ts +202 -1
- package/dist/visual/biology/physiology.js +1 -1
- package/dist/visual/biology/plant.d.ts +336 -1
- package/dist/visual/biology/plant.js +1 -1
- package/dist/visual/biology.d.ts +1 -1
- package/dist/visual/card.d.ts +79 -1
- package/dist/visual/card.js +18 -2
- package/dist/visual/catalog.d.ts +14164 -2
- package/dist/visual/catalog.js +4 -0
- package/dist/visual/chemistry/atom.d.ts +202 -1
- package/dist/visual/chemistry/atom.js +1 -1
- package/dist/visual/chemistry/balance.d.ts +336 -1
- package/dist/visual/chemistry/balance.js +1 -1
- package/dist/visual/chemistry/bonding.d.ts +336 -1
- package/dist/visual/chemistry/discovery.d.ts +470 -1
- package/dist/visual/chemistry/electrochemistry.d.ts +135 -1
- package/dist/visual/chemistry/electrochemistry.js +1 -1
- package/dist/visual/chemistry/electron.d.ts +135 -1
- package/dist/visual/chemistry/electron.js +1 -1
- package/dist/visual/chemistry/laws.d.ts +269 -1
- package/dist/visual/chemistry/laws.js +1 -1
- package/dist/visual/chemistry/particles.d.ts +336 -1
- package/dist/visual/chemistry/periodic.d.ts +135 -1
- package/dist/visual/chemistry/periodic.js +1 -1
- package/dist/visual/chemistry/rate.d.ts +68 -1
- package/dist/visual/chemistry/rate.js +1 -1
- package/dist/visual/chemistry/reaction.d.ts +202 -1
- package/dist/visual/chemistry/reaction.js +1 -1
- package/dist/visual/chemistry/titration.d.ts +68 -1
- package/dist/visual/chemistry/titration.js +1 -1
- package/dist/visual/length.d.ts +79 -0
- package/dist/visual/length.js +37 -0
- package/dist/visual/mathematics/chance.d.ts +258 -0
- package/dist/visual/mathematics/chance.js +117 -0
- package/dist/visual/mathematics/chart.d.ts +68 -1
- package/dist/visual/mathematics/charts.d.ts +336 -1
- package/dist/visual/mathematics/function.d.ts +202 -1
- package/dist/visual/mathematics/numeral.d.ts +170 -0
- package/dist/visual/mathematics/numeral.js +85 -0
- package/dist/visual/physics/braking.d.ts +269 -1
- package/dist/visual/physics/braking.js +1 -1
- package/dist/visual/physics/circuit.d.ts +269 -1
- package/dist/visual/physics/circular.d.ts +135 -1
- package/dist/visual/physics/circular.js +1 -1
- package/dist/visual/physics/dynamics.d.ts +470 -1
- package/dist/visual/physics/dynamics.js +1 -1
- package/dist/visual/physics/efficiency.d.ts +403 -1
- package/dist/visual/physics/efficiency.js +1 -1
- package/dist/visual/physics/electronics.d.ts +202 -1
- package/dist/visual/physics/falling.d.ts +269 -1
- package/dist/visual/physics/falling.js +1 -1
- package/dist/visual/physics/field.d.ts +202 -1
- package/dist/visual/physics/fluid.d.ts +269 -1
- package/dist/visual/physics/fluid.js +1 -1
- package/dist/visual/physics/force.d.ts +336 -1
- package/dist/visual/physics/gravity.d.ts +135 -1
- package/dist/visual/physics/heat.d.ts +202 -1
- package/dist/visual/physics/heat.js +1 -1
- package/dist/visual/physics/instrument.d.ts +470 -1
- package/dist/visual/physics/light.d.ts +269 -1
- package/dist/visual/physics/light.js +1 -1
- package/dist/visual/physics/measurement.d.ts +269 -1
- package/dist/visual/physics/measurement.js +1 -1
- package/dist/visual/physics/motion.d.ts +403 -1
- package/dist/visual/physics/nuclear.d.ts +202 -1
- package/dist/visual/physics/parabolic.d.ts +68 -1
- package/dist/visual/physics/position.d.ts +403 -1
- package/dist/visual/physics/position.js +1 -1
- package/dist/visual/physics/power.d.ts +537 -1
- package/dist/visual/physics/power.js +1 -1
- package/dist/visual/physics/precision.d.ts +470 -1
- package/dist/visual/physics/precision.js +1 -1
- package/dist/visual/physics/product.d.ts +269 -1
- package/dist/visual/physics/reading.d.ts +202 -1
- package/dist/visual/physics/reading.js +1 -1
- package/dist/visual/physics/record.d.ts +135 -1
- package/dist/visual/physics/record.js +1 -1
- package/dist/visual/physics/relative.d.ts +202 -1
- package/dist/visual/physics/relative.js +1 -1
- package/dist/visual/physics/solar.d.ts +403 -1
- package/dist/visual/physics/solar.js +1 -1
- package/dist/visual/physics/vector.d.ts +336 -1
- package/dist/visual/physics/vector.js +1 -1
- package/dist/visual/physics/velocity.d.ts +470 -1
- package/dist/visual/physics/wave.d.ts +269 -1
- package/dist/visual/politics.d.ts +403 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { FigureNodeSchema } from "#contracts/assessment/figure";
|
|
3
|
-
import {
|
|
3
|
+
import type { InlineInteractionNode, InlineNode } from "#contracts/assessment/inline";
|
|
4
4
|
/**
|
|
5
5
|
* Deepest nesting a document may have, counting `doc` as level 1 and a text
|
|
6
6
|
* node as a level. Sixteen is the nesting that Convex allows in one stored
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Predicate, Schema, SchemaTransformation } from "effect";
|
|
2
2
|
import { FigureNodeSchema, ImageSchema } from "#contracts/assessment/figure";
|
|
3
3
|
import { LocalIdSchema } from "#contracts/assessment/identity";
|
|
4
|
-
import { InlineContentSchema
|
|
4
|
+
import { InlineContentSchema } from "#contracts/assessment/inline";
|
|
5
5
|
import { LatexSchema, PlainTextSchema, PositiveIntSchema, } from "#contracts/assessment/scalar";
|
|
6
6
|
/**
|
|
7
7
|
* Deepest nesting a document may have, counting `doc` as level 1 and a text
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { AssessmentVisuals, VisualName } from "#contracts/visual/catalog";
|
|
3
3
|
/**
|
|
4
4
|
* One uploaded image. The text alternative is required, and the pixel size is
|
|
5
5
|
* required so a page can reserve the space before the file loads.
|
|
@@ -2,7 +2,7 @@ import { Array as Arr, Schema } from "effect";
|
|
|
2
2
|
import { AssetIdSchema } from "#contracts/assessment/identity";
|
|
3
3
|
import { RichTextSchema } from "#contracts/assessment/inline";
|
|
4
4
|
import { PlainTextSchema, PositiveIntSchema, } from "#contracts/assessment/scalar";
|
|
5
|
-
import { assessmentVisuals, FIGURE_NAMES
|
|
5
|
+
import { assessmentVisuals, FIGURE_NAMES } from "#contracts/visual/catalog";
|
|
6
6
|
/**
|
|
7
7
|
* One uploaded image. The text alternative is required, and the pixel size is
|
|
8
8
|
* required so a page can reserve the space before the file loads.
|
package/dist/assessment/fit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { AssessmentDocument } from "#contracts/assessment/document";
|
|
2
|
+
import type { Interaction } from "#contracts/assessment/interaction";
|
|
3
|
+
import type { ScoringOverride } from "#contracts/assessment/scoring";
|
|
4
4
|
/**
|
|
5
5
|
* Checks that the interactions of a version and its prompt agree: each
|
|
6
6
|
* interaction has its own identifier and sits in the prompt as its kind
|
package/dist/assessment/fit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Array as Arr, HashSet } from "effect";
|
|
2
|
-
import { documentPlacements
|
|
2
|
+
import { documentPlacements } from "#contracts/assessment/document";
|
|
3
3
|
import { hasDistinctIds, hasUniqueIds } from "#contracts/assessment/identity";
|
|
4
|
-
import { canSitInText
|
|
5
|
-
import { supportsRule
|
|
4
|
+
import { canSitInText } from "#contracts/assessment/interaction";
|
|
5
|
+
import { supportsRule } from "#contracts/assessment/scoring";
|
|
6
6
|
/**
|
|
7
7
|
* Checks that the prompt places one interaction where its kind belongs: a
|
|
8
8
|
* field exactly once, in text or as a block; a gap match once for each gap, in
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Option } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { CatalogRow } from "#contracts/assessment/catalog";
|
|
3
3
|
import type { ActiveAppLocaleList } from "#contracts/locale";
|
|
4
4
|
/**
|
|
5
5
|
* Finds the first catalog row that is not served where its node is: each row
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { InteractionKind } from "#contracts/assessment/interaction";
|
|
3
3
|
/**
|
|
4
4
|
* All or nothing: category 1 for a fully correct answer and 0 for any other,
|
|
5
5
|
* so k is 1. It is `match_correct` of QTI response processing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array as Arr, Match, Option, Schema } from "effect";
|
|
2
2
|
import { hasUniqueIds, LocalIdSchema } from "#contracts/assessment/identity";
|
|
3
|
-
import { canSitInText
|
|
3
|
+
import { canSitInText } from "#contracts/assessment/interaction";
|
|
4
4
|
import { LocalizedTextSchema, NonNegativeIntSchema, PlainTextSchema, PositiveIntSchema, } from "#contracts/assessment/scalar";
|
|
5
5
|
/**
|
|
6
6
|
* All or nothing: category 1 for a fully correct answer and 0 for any other,
|
package/dist/cache/content.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { Sha256Hash } from "#contracts/ids";
|
|
3
3
|
/** Mutable publication dependencies owned by the signed source contracts. */
|
|
4
4
|
export declare const ContentCacheScopeSchema: Schema.Literals<readonly ["article", "material", "page", "assessment", "program", "quran"]>;
|
|
5
5
|
export type ContentCacheScope = typeof ContentCacheScopeSchema.Type;
|
package/dist/cache/content.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { ContentFamilySchema } from "#contracts/content";
|
|
3
|
-
import { ReleaseIdSchema, Sha256HashSchema
|
|
3
|
+
import { ReleaseIdSchema, Sha256HashSchema } from "#contracts/ids";
|
|
4
4
|
import { ContentSnapshotKindSchema } from "#contracts/release/snapshot/scope";
|
|
5
5
|
const ARTIFACT_CACHE_PREFIX = "content-artifact:";
|
|
6
6
|
const SCOPE_CACHE_PREFIX = "content-scope:";
|
package/dist/content.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { PublicPath } from "#contracts/ids";
|
|
3
|
+
import { Sha256HashSchema } from "#contracts/ids";
|
|
4
|
+
import type { AppLocale } from "#contracts/locale";
|
|
4
5
|
/** Published content families backed by real Aksara source registries. */
|
|
5
6
|
export declare const ContentFamilySchema: Schema.Literals<readonly ["article", "material", "page"]>;
|
|
6
7
|
export type ContentFamily = typeof ContentFamilySchema.Type;
|
package/dist/graph/identity.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { LearningGraphIdentity } from "#contracts/graph/spec";
|
|
3
3
|
/** Validated hierarchy segments required to derive one graph identity. */
|
|
4
4
|
export declare const LearningGraphSegmentsSchema: Schema.Struct<{
|
|
5
5
|
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de", "ms"]>, "@NakafaAI/AksaraAppLocale">;
|
package/dist/graph/identity.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Effect, Schema } from "effect";
|
|
2
|
-
import { LearningGraphIdentitySchema
|
|
2
|
+
import { LearningGraphIdentitySchema } from "#contracts/graph/spec";
|
|
3
3
|
import { AppLocaleSchema } from "#contracts/locale";
|
|
4
4
|
import { isLowerKebab } from "#contracts/text/syntax";
|
|
5
5
|
const LearningGraphSegmentSchema = Schema.String.pipe(Schema.check(Schema.makeFilter(isLowerKebab)));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { PlaneMathObject } from "#contracts/math/plane";
|
|
3
|
+
/**
|
|
4
|
+
* Guardrail G5: a line, ray, segment or straight graph that runs along the
|
|
5
|
+
* boundary of a strict inequality of a region in the same scene draws dashed. Its points are
|
|
6
|
+
* not solutions, and the region draws that edge dashed too, so a solid line
|
|
7
|
+
* on it would say the opposite of the region.
|
|
8
|
+
*/
|
|
9
|
+
export declare function strictBoundaryIssues(objects: readonly PlaneMathObject[]): readonly Schema.FilterIssue[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Array as Arr, Match, Option, Result, Schema } from "effect";
|
|
2
|
+
import { readAffine } from "#contracts/math/formula/affine";
|
|
3
|
+
import { readFormula, readRelation } from "#contracts/math/formula/parse";
|
|
4
|
+
/**
|
|
5
|
+
* How far from a boundary line a point may lie and still stand on it, relative
|
|
6
|
+
* to the size of the line's terms there: room for the rounding of decimal
|
|
7
|
+
* coefficients such as 0.1, never for an authored approximation such as 3.33.
|
|
8
|
+
*/
|
|
9
|
+
const ON_LINE_TOLERANCE = 1e-9;
|
|
10
|
+
/**
|
|
11
|
+
* The boundary of one strict linear inequality of a region, `a x + b y + c = 0`,
|
|
12
|
+
* with the inequality as its author wrote it.
|
|
13
|
+
*/
|
|
14
|
+
const StrictBoundarySchema = Schema.Struct({
|
|
15
|
+
a: Schema.Finite,
|
|
16
|
+
b: Schema.Finite,
|
|
17
|
+
c: Schema.Finite,
|
|
18
|
+
inequality: Schema.String,
|
|
19
|
+
});
|
|
20
|
+
/** The boundary of an inequality when it is strict and linear in x and y. */
|
|
21
|
+
function strictBoundary(inequality) {
|
|
22
|
+
return Result.getSuccess(readRelation(inequality)).pipe(Option.filter(({ comparison }) => comparison === "<" || comparison === ">"), Option.flatMap(({ left, right }) => readAffine({ kind: "binary", left, operator: "-", right }, ["x", "y"])), Option.flatMap(({ constant, terms }) => {
|
|
23
|
+
const a = terms.x ?? 0;
|
|
24
|
+
const b = terms.y ?? 0;
|
|
25
|
+
return a === 0 && b === 0
|
|
26
|
+
? Option.none()
|
|
27
|
+
: Option.some({ a, b, c: constant, inequality });
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
/** Whether a point stands on a boundary line. */
|
|
31
|
+
function onLine({ a, b, c }, { x, y }) {
|
|
32
|
+
const value = a * x + b * y + c;
|
|
33
|
+
const size = Math.abs(a * x) + Math.abs(b * y) + Math.abs(c);
|
|
34
|
+
return Math.abs(value) <= ON_LINE_TOLERANCE * Math.max(1, size);
|
|
35
|
+
}
|
|
36
|
+
/** Two points of a graph that is a straight line: an affine formula in its input axis. */
|
|
37
|
+
function straightGraph(formula, input) {
|
|
38
|
+
return Result.getSuccess(readFormula(formula)).pipe(Option.flatMap((node) => readAffine(node, [input])), Option.map(({ constant, terms }) => {
|
|
39
|
+
const slope = terms[input] ?? 0;
|
|
40
|
+
/** The graph's point at one value of its input. */
|
|
41
|
+
const at = (value) => input === "x"
|
|
42
|
+
? { x: value, y: slope * value + constant }
|
|
43
|
+
: { x: slope * value + constant, y: value };
|
|
44
|
+
return [at(0), at(1)];
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
/** Two points of a straight object: a line, ray, segment or straight graph. */
|
|
48
|
+
function straightPoints(object) {
|
|
49
|
+
return Match.value(object).pipe(Match.discriminators("kind")({
|
|
50
|
+
function: ({ formula, inputAxis = "x" }) => straightGraph(formula, inputAxis),
|
|
51
|
+
line: ({ through }) => Option.some(through),
|
|
52
|
+
ray: ({ from, through }) => Option.some([from, through]),
|
|
53
|
+
segment: ({ from, to }) => Option.some([from, to]),
|
|
54
|
+
}), Match.orElse(() => Option.none()));
|
|
55
|
+
}
|
|
56
|
+
/** Two points of a straight object drawn solid, which a strict boundary may not hold. */
|
|
57
|
+
function solidStraight(object) {
|
|
58
|
+
return "stroke" in object && object.stroke !== undefined
|
|
59
|
+
? Option.none()
|
|
60
|
+
: straightPoints(object);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Guardrail G5: a line, ray, segment or straight graph that runs along the
|
|
64
|
+
* boundary of a strict inequality of a region in the same scene draws dashed. Its points are
|
|
65
|
+
* not solutions, and the region draws that edge dashed too, so a solid line
|
|
66
|
+
* on it would say the opposite of the region.
|
|
67
|
+
*/
|
|
68
|
+
export function strictBoundaryIssues(objects) {
|
|
69
|
+
const boundaries = Arr.flatMap(objects, (object) => object.kind === "region"
|
|
70
|
+
? Arr.getSomes(Arr.map(object.inequalities, strictBoundary))
|
|
71
|
+
: []);
|
|
72
|
+
return Arr.flatMap(objects, (object, index) => solidStraight(object).pipe(Option.flatMap(([from, to]) => Arr.findFirst(boundaries, (boundary) => onLine(boundary, from) && onLine(boundary, to))), Option.match({
|
|
73
|
+
onNone: () => [],
|
|
74
|
+
onSome: ({ inequality }) => [
|
|
75
|
+
{
|
|
76
|
+
issue: `Expected the ${object.kind === "function" ? "graph" : object.kind} on the boundary of the strict inequality "${inequality}" to be dashed (stroke: "dashed"): the points on it are not solutions.`,
|
|
77
|
+
path: ["objects", index],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
})));
|
|
81
|
+
}
|
package/dist/math/bounds.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
2
|
import type { FormulaScope } from "#contracts/math/formula/compile";
|
|
3
3
|
import type { PlaneLabelAnchor, PlaneMathFrame, PlaneMathObject } from "#contracts/math/plane";
|
|
4
4
|
import type { SpaceLabelAnchor, SpaceMathFrame, SpaceMathObject, SpaceMathView } from "#contracts/math/space";
|
package/dist/math/collision.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BigDecimal } from "effect";
|
|
2
2
|
import type { SceneCoordinate } from "#contracts/math/coordinate";
|
|
3
3
|
import type { PlaneMathObject } from "#contracts/math/plane";
|
|
4
4
|
/** Finds reportable scene coordinates that collapse on the same axis. */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { BigDecimal } from "effect";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import type { PlanePoint, SceneAxis, SpacePoint } from "#contracts/math/base";
|
|
4
|
+
import type { InfinitePathKind } from "#contracts/math/intersection";
|
|
4
5
|
import type { PlaneMathFrame } from "#contracts/math/plane";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import type { RenderThreshold } from "#contracts/math/precision";
|
|
7
|
+
import type { ExactRatio } from "#contracts/math/rational";
|
|
7
8
|
import type { SpaceMathFrame } from "#contracts/math/space";
|
|
8
9
|
export declare const ScenePathSchema: Schema.mutable<Schema.$Array<Schema.Union<readonly [Schema.Finite, Schema.String]>>>;
|
|
9
10
|
export type ScenePath = typeof ScenePathSchema.Type;
|
package/dist/math/coordinate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Schema } from "effect";
|
|
2
|
-
import { SceneAxisSchema
|
|
2
|
+
import { SceneAxisSchema } from "#contracts/math/base";
|
|
3
3
|
import { AxisTraversalSchema, infinitePathInterval, } from "#contracts/math/intersection";
|
|
4
|
-
import { visiblePathResolvable
|
|
4
|
+
import { visiblePathResolvable } from "#contracts/math/precision";
|
|
5
5
|
import { affineRatio, ExactRatioSchema, numberRatio, } from "#contracts/math/rational";
|
|
6
6
|
export const ScenePathSchema = Schema.mutable(Schema.Array(Schema.Union([Schema.Finite, Schema.String])));
|
|
7
7
|
/** One ordered exact coordinate projected from a complete visual scene. */
|
package/dist/math/curve.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Schema } from "effect";
|
|
|
3
3
|
export declare const PlaneCurveObjectSchemas: readonly [Schema.Struct<{
|
|
4
4
|
readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
5
5
|
readonly id: Schema.String;
|
|
6
|
+
readonly stroke: Schema.optionalKey<Schema.Literals<readonly ["dashed"]>>;
|
|
6
7
|
readonly domain: Schema.optionalKey<Schema.Struct<{
|
|
7
8
|
readonly max: Schema.Finite;
|
|
8
9
|
readonly min: Schema.Finite;
|
package/dist/math/curve.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { MathAxisRangeSchema } from "#contracts/math/base";
|
|
3
3
|
import { EquationTextSchema, FormulaTextSchema, InequalityTextSchema, PlaneFormulaPointSchema, } from "#contracts/math/formula/field";
|
|
4
|
-
import { MathObjectFields } from "#contracts/math/object";
|
|
4
|
+
import { MathObjectFields, MathStrokeFields } from "#contracts/math/object";
|
|
5
5
|
/**
|
|
6
6
|
* The graph of y = f(x), or of x = f(y) when its input axis is y. The renderer
|
|
7
7
|
* samples it inside the frame, at least 200 times per visible branch, exactly
|
|
8
8
|
* at its domain ends and labels, and splits it at every break and asymptote.
|
|
9
|
-
* Without a domain it spans the frame along its input axis.
|
|
9
|
+
* Without a domain it spans the frame along its input axis. A straight graph
|
|
10
|
+
* on the boundary of a strict inequality draws dashed (`MathStrokeSchema`).
|
|
10
11
|
*/
|
|
11
12
|
const PlaneFunctionObjectSchema = Schema.Struct({
|
|
12
13
|
...MathObjectFields,
|
|
14
|
+
...MathStrokeFields,
|
|
13
15
|
domain: Schema.optionalKey(MathAxisRangeSchema),
|
|
14
16
|
formula: FormulaTextSchema,
|
|
15
17
|
inputAxis: Schema.optionalKey(Schema.Literals(["x", "y"])),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
import type { FormulaNode } from "#contracts/math/formula/syntax";
|
|
3
|
+
/**
|
|
4
|
+
* An affine expression: a constant plus one coefficient for each variable it
|
|
5
|
+
* reads, such as `2x + 5y - 10`, read as 2 for x, 5 for y and -10.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AffineSchema: Schema.Struct<{
|
|
8
|
+
readonly constant: Schema.Finite;
|
|
9
|
+
readonly terms: Schema.$Record<Schema.String, Schema.Finite>;
|
|
10
|
+
}>;
|
|
11
|
+
export type Affine = typeof AffineSchema.Type;
|
|
12
|
+
/** The value of an affine expression that reads no variable, if it reads none. */
|
|
13
|
+
export declare function affineConstant(affine: Affine): Option.None<number> | Option.Some<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Reads a formula as an affine expression in the given variables, from its
|
|
16
|
+
* syntax and without sampling it: sums, differences and constant multiples of
|
|
17
|
+
* the variables, with any part that reads no name folded to its value. A
|
|
18
|
+
* formula that multiplies two variables, divides by one, or calls a function
|
|
19
|
+
* of one is not affine, and neither is one that reads any other name, such as
|
|
20
|
+
* a slider's parameter, whose value changes as the reader moves it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readAffine(node: FormulaNode, variables: readonly string[]): Option.Option<Affine>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Array as Arr, Match, Option, Record as Rec, Schema } from "effect";
|
|
2
|
+
import { compileFormula } from "#contracts/math/formula/compile";
|
|
3
|
+
/**
|
|
4
|
+
* An affine expression: a constant plus one coefficient for each variable it
|
|
5
|
+
* reads, such as `2x + 5y - 10`, read as 2 for x, 5 for y and -10.
|
|
6
|
+
*/
|
|
7
|
+
export const AffineSchema = Schema.Struct({
|
|
8
|
+
constant: Schema.Finite,
|
|
9
|
+
terms: Schema.Record(Schema.String, Schema.Finite),
|
|
10
|
+
});
|
|
11
|
+
/** An expression that reads no variable. */
|
|
12
|
+
function constant(value) {
|
|
13
|
+
return { constant: value, terms: {} };
|
|
14
|
+
}
|
|
15
|
+
/** Multiplies every part of an affine expression by one number. */
|
|
16
|
+
function scale(affine, factor) {
|
|
17
|
+
return {
|
|
18
|
+
constant: affine.constant * factor,
|
|
19
|
+
terms: Rec.map(affine.terms, (coefficient) => coefficient * factor),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Adds two affine expressions, or subtracts the second when `sign` is -1. */
|
|
23
|
+
function combine(left, right, sign) {
|
|
24
|
+
const names = Arr.dedupe([...Rec.keys(left.terms), ...Rec.keys(right.terms)]);
|
|
25
|
+
return {
|
|
26
|
+
constant: left.constant + sign * right.constant,
|
|
27
|
+
terms: Rec.fromEntries(Arr.map(names, (name) => [
|
|
28
|
+
name,
|
|
29
|
+
(left.terms[name] ?? 0) + sign * (right.terms[name] ?? 0),
|
|
30
|
+
])),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The value of an affine expression that reads no variable, if it reads none. */
|
|
34
|
+
export function affineConstant(affine) {
|
|
35
|
+
return Arr.every(Rec.values(affine.terms), (coefficient) => coefficient === 0)
|
|
36
|
+
? Option.some(affine.constant)
|
|
37
|
+
: Option.none();
|
|
38
|
+
}
|
|
39
|
+
/** Reads a product, which stays affine while one side is a constant. */
|
|
40
|
+
function product(left, right) {
|
|
41
|
+
return Option.orElse(Option.map(affineConstant(left), (factor) => scale(right, factor)), () => Option.map(affineConstant(right), (factor) => scale(left, factor)));
|
|
42
|
+
}
|
|
43
|
+
/** Reads a quotient, which stays affine while its divisor is a constant other than zero. */
|
|
44
|
+
function quotient(left, right) {
|
|
45
|
+
return Option.flatMap(affineConstant(right), (divisor) => divisor === 0 ? Option.none() : Option.some(scale(left, 1 / divisor)));
|
|
46
|
+
}
|
|
47
|
+
/** How each operator combines two affine expressions, while the result stays affine. */
|
|
48
|
+
const OPERATORS = {
|
|
49
|
+
"-": (left, right) => Option.some(combine(left, right, -1)),
|
|
50
|
+
"*": product,
|
|
51
|
+
"/": quotient,
|
|
52
|
+
// Only a power of one keeps a variable affine.
|
|
53
|
+
"^": (left, right) => Option.filter(affineConstant(right), (power) => power === 1).pipe(Option.as(left)),
|
|
54
|
+
"+": (left, right) => Option.some(combine(left, right, 1)),
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Reads a formula as an affine expression in the given variables, from its
|
|
58
|
+
* syntax and without sampling it: sums, differences and constant multiples of
|
|
59
|
+
* the variables, with any part that reads no name folded to its value. A
|
|
60
|
+
* formula that multiplies two variables, divides by one, or calls a function
|
|
61
|
+
* of one is not affine, and neither is one that reads any other name, such as
|
|
62
|
+
* a slider's parameter, whose value changes as the reader moves it.
|
|
63
|
+
*/
|
|
64
|
+
export function readAffine(node, variables) {
|
|
65
|
+
const value = compileFormula(node)({});
|
|
66
|
+
if (Number.isFinite(value)) {
|
|
67
|
+
return Option.some(constant(value));
|
|
68
|
+
}
|
|
69
|
+
return Match.value(node).pipe(Match.discriminators("kind")({
|
|
70
|
+
binary: ({ left, operator, right }) => Option.flatMap(Option.all([
|
|
71
|
+
readAffine(left, variables),
|
|
72
|
+
readAffine(right, variables),
|
|
73
|
+
]), ([first, second]) => OPERATORS[operator](first, second)),
|
|
74
|
+
name: ({ name }) => Arr.contains(variables, name)
|
|
75
|
+
? Option.some({ constant: 0, terms: { [name]: 1 } })
|
|
76
|
+
: Option.none(),
|
|
77
|
+
negate: ({ operand }) => Option.map(readAffine(operand, variables), (read) => scale(read, -1)),
|
|
78
|
+
}), Match.orElse(() => Option.none()));
|
|
79
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FormulaNode } from "#contracts/math/formula/syntax";
|
|
2
2
|
/** The value of every variable and parameter a formula reads, by name. */
|
|
3
3
|
export type FormulaScope = Readonly<Record<string, number>>;
|
|
4
4
|
/** A compiled formula: its value for one scope, or NaN where it is undefined. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr } from "effect";
|
|
2
|
-
import { FORMULA_CONSTANTS
|
|
2
|
+
import { FORMULA_CONSTANTS } from "#contracts/math/formula/syntax";
|
|
3
3
|
/** Odd root indexes tried for a negative base, so `x^(1/3)` is real for x < 0. */
|
|
4
4
|
const ODD_ROOTS = [3, 5, 7, 9, 11];
|
|
5
5
|
const ROOT_TOLERANCE = 1e-9;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SampleBox } from "#contracts/math/formula/box";
|
|
2
2
|
import type { SampleBranch } from "#contracts/math/formula/sample";
|
|
3
3
|
/** A field over the plane: its value at one point, NaN where it is undefined. */
|
|
4
4
|
export type SampleField = (x: number, y: number) => number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, MutableHashMap, MutableHashSet, MutableList, Option, Result, Schema, } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
3
|
/** Cells per frame side, enough for a smooth outline at the largest card size. */
|
|
4
4
|
export const CONTOUR_CELLS = 240;
|
|
5
5
|
/** One grid corner: its key, its point, and the field's value there when defined. */
|
|
@@ -99,7 +99,12 @@ function cellSegments(field, cell) {
|
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Joins segments that share an edge crossing into continuous polylines. A
|
|
104
|
+
* line grows from its first segment in both directions: the grid lists cells
|
|
105
|
+
* column by column, so a segment found first may lie in the middle of its
|
|
106
|
+
* curve, and its two ends may point either way along it.
|
|
107
|
+
*/
|
|
103
108
|
function join(segments) {
|
|
104
109
|
const byKey = MutableHashMap.empty();
|
|
105
110
|
Arr.forEach(segments, (segment) => {
|
|
@@ -109,15 +114,10 @@ function join(segments) {
|
|
|
109
114
|
}
|
|
110
115
|
});
|
|
111
116
|
const used = MutableHashSet.empty();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
MutableHashSet.add(used, start.index);
|
|
117
|
-
const line = MutableList.make();
|
|
118
|
-
MutableList.append(line, start.from.point);
|
|
119
|
-
MutableList.append(line, start.to.point);
|
|
120
|
-
let { key } = start.to;
|
|
117
|
+
/** The points of the unused segments that continue a line from one crossing, in order. */
|
|
118
|
+
const follow = (from) => {
|
|
119
|
+
const points = MutableList.make();
|
|
120
|
+
let key = from;
|
|
121
121
|
let next = Option.none();
|
|
122
122
|
do {
|
|
123
123
|
next = Arr.findFirst(Arr.flatten(Option.toArray(MutableHashMap.get(byKey, key))), (segment) => !MutableHashSet.has(used, segment.index));
|
|
@@ -125,11 +125,26 @@ function join(segments) {
|
|
|
125
125
|
const segment = next.value;
|
|
126
126
|
MutableHashSet.add(used, segment.index);
|
|
127
127
|
const forward = segment.from.key === key;
|
|
128
|
-
MutableList.append(
|
|
128
|
+
MutableList.append(points, forward ? segment.to.point : segment.from.point);
|
|
129
129
|
key = forward ? segment.to.key : segment.from.key;
|
|
130
130
|
}
|
|
131
131
|
} while (Option.isSome(next));
|
|
132
|
-
return
|
|
132
|
+
return MutableList.toArray(points);
|
|
133
|
+
};
|
|
134
|
+
return Arr.filterMap(segments, (start) => {
|
|
135
|
+
if (MutableHashSet.has(used, start.index)) {
|
|
136
|
+
return Result.failVoid;
|
|
137
|
+
}
|
|
138
|
+
MutableHashSet.add(used, start.index);
|
|
139
|
+
// A closed curve comes back to the start ahead, which leaves nothing behind it.
|
|
140
|
+
const ahead = follow(start.to.key);
|
|
141
|
+
const behind = follow(start.from.key);
|
|
142
|
+
return Result.succeed([
|
|
143
|
+
...Arr.reverse(behind),
|
|
144
|
+
start.from.point,
|
|
145
|
+
start.to.point,
|
|
146
|
+
...ahead,
|
|
147
|
+
]);
|
|
133
148
|
});
|
|
134
149
|
}
|
|
135
150
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Result, Schema } from "effect";
|
|
2
2
|
import { MathVisualKeySchema } from "#contracts/math/base";
|
|
3
3
|
import { readFormula, readRelation } from "#contracts/math/formula/parse";
|
|
4
|
-
import { FormulaParameterNameSchema
|
|
4
|
+
import { FormulaParameterNameSchema } from "#contracts/math/formula/syntax";
|
|
5
5
|
/** Passes a formula that reads, or names the problem of one that does not. */
|
|
6
6
|
function readable(read) {
|
|
7
7
|
return (text) => Result.match(read(text), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { SamplePoint, SampleRange } from "#contracts/math/formula/box";
|
|
3
3
|
/** Cells along each side of a sampled surface. */
|
|
4
4
|
export declare const MESH_CELLS = 96;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Option, Schema } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
3
|
/** Cells along each side of a sampled surface. */
|
|
4
4
|
export const MESH_CELLS = 96;
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HashSet } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { FormulaNode } from "#contracts/math/formula/syntax";
|
|
3
3
|
/** Every variable and parameter a node reads; constants are left out. */
|
|
4
4
|
export declare function formulaNames(node: FormulaNode): HashSet.HashSet<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, HashSet } from "effect";
|
|
2
|
-
import { FORMULA_CONSTANTS
|
|
2
|
+
import { FORMULA_CONSTANTS } from "#contracts/math/formula/syntax";
|
|
3
3
|
/** Every variable and parameter a node reads; constants are left out. */
|
|
4
4
|
export function formulaNames(node) {
|
|
5
5
|
if (node.kind === "number") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { FormulaError, FormulaNode } from "#contracts/math/formula/syntax";
|
|
3
3
|
/** Reads a formula that is one expression, such as `2x^2 - 3x + 1`. */
|
|
4
4
|
export declare function readFormula(text: string): Result.Result<FormulaNode, FormulaError>;
|
|
5
5
|
/** Reads one equation or inequality, such as `x^2 + y^2 = 4` or `y < 2x + 1`. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array as Arr, MutableList, Option, Result, Schema } from "effect";
|
|
2
2
|
import { at, expect, finished, here, peek, problemAt, startReader, } from "#contracts/math/formula/reader";
|
|
3
|
-
import { FormulaFunctionSchema
|
|
3
|
+
import { FormulaFunctionSchema } from "#contracts/math/formula/syntax";
|
|
4
4
|
/** How tightly each operator holds its operands; implicit products bind like `*`. */
|
|
5
5
|
const SUM = 10;
|
|
6
6
|
const PRODUCT = 20;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Option, Result, Schema } from "effect";
|
|
2
2
|
import type { PlaneCurveObjectSchemas } from "#contracts/math/curve";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { SampleBox, SamplePoint } from "#contracts/math/formula/box";
|
|
4
|
+
import type { FormulaEvaluator, FormulaScope } from "#contracts/math/formula/compile";
|
|
5
5
|
import type { PlaneFormulaPoint } from "#contracts/math/formula/field";
|
|
6
6
|
import type { FormulaError } from "#contracts/math/formula/syntax";
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Option, Result, Schema } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
3
|
-
import { compileFormula
|
|
4
|
-
import { contourLines
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
|
+
import { compileFormula } from "#contracts/math/formula/compile";
|
|
4
|
+
import { contourLines } from "#contracts/math/formula/contour";
|
|
5
5
|
import { SampleGridSchema } from "#contracts/math/formula/mesh";
|
|
6
6
|
import { readFormula, readRelation } from "#contracts/math/formula/parse";
|
|
7
7
|
import { regionGeometry } from "#contracts/math/formula/region";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Option, Result, Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { FormulaProblem } from "#contracts/math/formula/syntax";
|
|
3
|
+
import { FormulaError } from "#contracts/math/formula/syntax";
|
|
3
4
|
/**
|
|
4
5
|
* The tokens of one formula and the reader's place in them: the token it
|
|
5
6
|
* stands at and how many absolute bars are open around it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Option, Result, Schema } from "effect";
|
|
2
|
-
import { FormulaError
|
|
2
|
+
import { FormulaError } from "#contracts/math/formula/syntax";
|
|
3
3
|
import { FormulaTokenSchema, tokenizeFormula, } from "#contracts/math/formula/token";
|
|
4
4
|
/**
|
|
5
5
|
* The tokens of one formula and the reader's place in them: the token it
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { SampleBox } from "#contracts/math/formula/box";
|
|
3
|
+
import type { FormulaScope } from "#contracts/math/formula/compile";
|
|
4
4
|
/** The region where every inequality holds, with each edge marked strict or not. */
|
|
5
5
|
export declare function regionGeometry(inequalities: readonly [string, ...string[]], box: SampleBox, scope: FormulaScope): Result.Result<{
|
|
6
6
|
boundary: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, MutableList, Option, Order, Result, Schema, } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
3
|
-
import { compileFormula
|
|
4
|
-
import { contourFill, contourLines
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
|
+
import { compileFormula } from "#contracts/math/formula/compile";
|
|
4
|
+
import { contourFill, contourLines } from "#contracts/math/formula/contour";
|
|
5
5
|
import { readRelation } from "#contracts/math/formula/parse";
|
|
6
6
|
import { someCell } from "#contracts/math/formula/scan";
|
|
7
7
|
/** How far a boundary piece lies from one inequality's edge, and whether that edge is strict. */
|