@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.
@@ -51,17 +51,33 @@ export type SearchResult = {
51
51
  gen: number;
52
52
  cache?: Expr[][];
53
53
  };
54
- declare function search(seed: Expr[], options: SearchOptions, predicate: SearchCallback): SearchResult;
54
+ export type EquivResult = {
55
+ steps: number;
56
+ equal: boolean;
57
+ normal: boolean;
58
+ canonical: [Expr | null, Expr | null];
59
+ };
55
60
  /**
56
- * Recursively replace all instances of Expr in a data structure with
57
- * respective string representation using the format() options.
58
- * Objects of other types and primitive values are eft as is.
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
- * May be useful for debugging or diagnostic output.
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 deepFormat(obj: any, options?: FormatOptions): any;
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
- * Converts an unknown object into a FormatOptions, or returns an error it it is not valid.
79
- * A null/undefined counts as an empty options object (and is thus valid).
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 checkFormatOptions(raw: unknown): {
82
- value: FormatOptions;
83
- } | {
84
- error: Record<string, string>;
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 {};
@@ -50,6 +50,7 @@ export declare class SKI extends Parser {
50
50
  } | {
51
51
  error: Record<string, string>;
52
52
  };
53
+ equiv: (e1: import("./expr").Expr, e2: import("./expr").Expr, options?: {}) => import("./extras").EquivResult;
53
54
  };
54
55
  static Quest: typeof Quest;
55
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dallaylaen/ski-interpreter",
3
- "version": "2.8.0",
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",