@dallaylaen/ski-interpreter 1.1.0 → 1.3.0

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 CHANGED
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.0] - 2026-01-25
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ - Remove `Expr.reduce()` method for good (too ambiguous). See also `Expr.invoke()` below.
13
+ - Remove `onApply` hook from `Native` combinators.
14
+
15
+ ### Added
16
+
17
+ - Expr: Add `invoke(arg: Expr)` method implementing actual rewriting rules.
18
+ - SKI: `add(term, impl, note?)` method now accepts a function as `impl` to define native combinators directly.
19
+ - Improved jsdoc somewhat.
20
+
21
+ ## [1.2.0] - 2025-12-14
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ - Remove `toString()` options, use `format()` instead.
26
+ - Make `needsParens()` private (should've been to begin with)
27
+ - Remove unused `renameVars()` method.
28
+ - Remove Expr.`toJSON()`
29
+
30
+ ### Added
31
+
32
+ - SKI: `toJSON()` now recreates declarations exactly, preserving named subexpressions.
33
+ - SKI: `declare()` / `bulkAdd()` methods to export/import term definitions.
34
+ - Expr: `format(options?)` method for pretty-printing expressions with various options: html, verbosity, custom lambdas, custom brackets etc.
35
+ - Expr: `subst(find, replace)` now works for any type of find except application and lambdas.
36
+ - Playground: permalinks now use #hash instead of a ?query string. (Old links still supported).
37
+ - Playground: togglable frames around subexpressions & variable/redex highlighting.
38
+
8
39
  ## [1.1.0] - 2025-12-07
9
40
 
10
41
  ### BREAKING CHANGES
@@ -21,7 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
52
  - Expr: guess() method to normalize terms.
22
53
  Returns an object with `normal`: boolean and `steps`:
23
54
  number properties, as well as optional `expr`: Expr -
24
- equivalent lambda expression; `arity`: number,
55
+ equivalent lambda expression; `arity`: number,
25
56
  and other properties.
26
57
  - Expr: replace(terms: Expr[], options: {}) replaces
27
58
  subtrees with matching canonical form (if they have one).
package/README.md CHANGED
@@ -46,6 +46,25 @@ that has enough arguments is executed and the step ends there.
46
46
  Lambda terms are lazy, i.e. the body is not touched until
47
47
  all free variables are bound.
48
48
 
49
+ # Playground
50
+
51
+ https://dallaylaen.github.io/ski-interpreter/
52
+
53
+ * all of the above features (except comparison and JS-native terms) in your browser
54
+ * expressions have permalinks
55
+ * can configure verbosity & executeion speed
56
+
57
+ # Quests
58
+
59
+ https://dallaylaen.github.io/ski-interpreter/quest.html
60
+
61
+ This page contains small tasks of increasing complexity.
62
+ Each task requires the user to build a combinator with specific properties.
63
+
64
+ # CLI
65
+
66
+ REPL comes with the package as [bin/ski.js](bin/ski.js).
67
+
49
68
  # Installation
50
69
 
51
70
  ```bash
@@ -100,24 +119,6 @@ const [x, y] = SKI.free('x', 'y'); // free variables
100
119
  SKI.church(5).apply(x, y).run().expr + ''; // 'x(x(x(x(x y))))'
101
120
  ```
102
121
 
103
- # Playground
104
-
105
- https://dallaylaen.github.io/ski-interpreter/
106
-
107
- * all of the above features (except comparison and JS-native terms) in your browser
108
- * expressions have permalinks
109
- * can configure verbosity & executeion speed
110
-
111
- # Quests
112
-
113
- https://dallaylaen.github.io/ski-interpreter/quest.html
114
-
115
- This page contains small tasks of increasing complexity.
116
- Each task requires the user to build a combinator with specific properties.
117
-
118
- # CLI
119
-
120
- REPL comes with the package as [bin/ski.js](bin/ski.js).
121
122
 
122
123
 
123
124
 
@@ -131,6 +132,7 @@ REPL comes with the package as [bin/ski.js](bin/ski.js).
131
132
  * "To Mock The Mockingbird" by Raymond Smulian.
132
133
  * [combinator birds](https://www.angelfire.com/tx4/cus/combinator/birds.html) by [Chris Rathman](https://www.angelfire.com/tx4/cus/index.html)
133
134
  * [Fun with combinators](https://doisinkidney.com/posts/2020-10-17-ski.html) by [@oisdk](https://github.com/oisdk)
135
+ * [Conbinatris](https://dirk.rave.org/combinatris/) by Dirk van Deun
134
136
 
135
137
  # License and copyright
136
138
 
package/bin/ski.js CHANGED
@@ -69,7 +69,7 @@ function runLine(onErr) {
69
69
  if (state.final && !options.q)
70
70
  console.log(`// ${state.steps} step(s) in ${new Date() - t0}ms`);
71
71
  if (options.v || state.final)
72
- console.log('' + state.expr.toString({terse: options.t}));
72
+ console.log('' + state.expr.format({terse: options.t}));
73
73
  if (state.final && expr instanceof SKI.classes.Alias)
74
74
  ski.add(expr.name, state.expr);
75
75
  }