@dallaylaen/ski-interpreter 2.8.0 → 2.8.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/CHANGELOG.md +12 -0
- package/bin/ski.js +17 -0
- package/lib/ski-interpreter.cjs.js +78 -61
- package/lib/ski-interpreter.cjs.js.map +2 -2
- package/lib/ski-interpreter.min.js +5 -5
- package/lib/ski-interpreter.min.js.map +3 -3
- package/lib/ski-interpreter.mjs +78 -61
- package/lib/ski-interpreter.mjs.map +2 -2
- package/lib/ski-quest.min.js +4 -4
- package/lib/ski-quest.min.js.map +3 -3
- package/lib/types/extras.d.ts +37 -13
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
package/lib/types/extras.d.ts
CHANGED
|
@@ -51,17 +51,33 @@ export type SearchResult = {
|
|
|
51
51
|
gen: number;
|
|
52
52
|
cache?: Expr[][];
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
export type EquivResult = {
|
|
55
|
+
steps: number;
|
|
56
|
+
equal: boolean;
|
|
57
|
+
normal: boolean;
|
|
58
|
+
canonical: [Expr | null, Expr | null];
|
|
59
|
+
};
|
|
55
60
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
61
|
+
* Converts an unknown object into a FormatOptions, or returns an error it it is not valid.
|
|
62
|
+
* A null/undefined counts as an empty options object (and is thus valid).
|
|
63
|
+
*/
|
|
64
|
+
declare function checkFormatOptions(raw: unknown): {
|
|
65
|
+
value: FormatOptions;
|
|
66
|
+
} | {
|
|
67
|
+
error: Record<string, string>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Find out if two expressions are computationally equivalent.
|
|
59
71
|
*
|
|
60
|
-
*
|
|
72
|
+
* Unlike equals(), this function will attempt to normalize both expressions
|
|
73
|
+
* before comparing.
|
|
61
74
|
*
|
|
62
75
|
* @experimental
|
|
76
|
+
* @param e1
|
|
77
|
+
* @param e2
|
|
78
|
+
* @param options
|
|
63
79
|
*/
|
|
64
|
-
declare function
|
|
80
|
+
declare function equiv(e1: Expr, e2: Expr, options?: {}): EquivResult;
|
|
65
81
|
/**
|
|
66
82
|
* Given an expression and a hash of named terms,
|
|
67
83
|
* return a semicolon-separated string that declares said expression
|
|
@@ -75,19 +91,27 @@ declare function deepFormat(obj: any, options?: FormatOptions): any;
|
|
|
75
91
|
*/
|
|
76
92
|
declare function declare(expr: Expr, env?: Record<string, Named>): string;
|
|
77
93
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
94
|
+
* Recursively replace all instances of Expr in a data structure with
|
|
95
|
+
* respective string representation using the format() options.
|
|
96
|
+
* Objects of other types and primitive values are eft as is.
|
|
97
|
+
*
|
|
98
|
+
* May be useful for debugging or diagnostic output.
|
|
99
|
+
*
|
|
100
|
+
* @experimental
|
|
80
101
|
*/
|
|
81
|
-
declare function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
102
|
+
declare function deepFormat(obj: any, options?: FormatOptions): any;
|
|
103
|
+
/**
|
|
104
|
+
* @experimental
|
|
105
|
+
* Look for an expression that matches the predicate,
|
|
106
|
+
* starting with the seed and applying the terms to one another.
|
|
107
|
+
*/
|
|
108
|
+
declare function search(seed: Expr[], options: SearchOptions, predicate: SearchCallback): SearchResult;
|
|
86
109
|
export declare const extras: {
|
|
87
110
|
search: typeof search;
|
|
88
111
|
deepFormat: typeof deepFormat;
|
|
89
112
|
declare: typeof declare;
|
|
90
113
|
toposort: typeof toposort;
|
|
91
114
|
checkFormatOptions: typeof checkFormatOptions;
|
|
115
|
+
equiv: typeof equiv;
|
|
92
116
|
};
|
|
93
117
|
export {};
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dallaylaen/ski-interpreter",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Simple Kombinator Interpreter - a combinatory logic & lambda calculus parser and interpreter. Supports SKI, BCKW, Church numerals, and setting up assertions ('quests') involving all of the above.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"combinatory logic",
|