@dallaylaen/ski-interpreter 2.3.0 → 2.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dallaylaen/ski-interpreter",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
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",
@@ -71,4 +71,18 @@ export function deepFormat(obj: any, options?: object): any;
71
71
  export function declare(expr: Expr, env?: {
72
72
  [s: string]: Named;
73
73
  }): string;
74
+ /**
75
+ * @experimental
76
+ * @desc Fold an application tree bottom to top.
77
+ * For each subtree, the function is given the term in the root position and
78
+ * a list of the results of folding its arguments.
79
+ *
80
+ * E,g, fold('x y (z t)', f) results in f(x, [f(y, []), f(z, [f(t, [])])])
81
+ *
82
+ * @template T
83
+ * @param {Expr} expr
84
+ * @param {(head: Expr, tail: T[]) => T} fun
85
+ * @return {T}
86
+ */
87
+ export function foldr<T>(expr: Expr, fun: (head: Expr, tail: T[]) => T): T;
74
88
  import { Expr } from "./expr";