@plylang/plylang 1.1.2 → 1.1.4
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/README.md +13 -13
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -34,13 +34,13 @@ An omitted stack bottom is the same tail on the left and on the right. An explic
|
|
|
34
34
|
|
|
35
35
|
Five built-in types and two constructors of arity 1 are visible in every module. They cannot be redefined.
|
|
36
36
|
|
|
37
|
-
| Type
|
|
38
|
-
|
|
|
39
|
-
| `Num`
|
|
40
|
-
| `Int`
|
|
41
|
-
| `Str`
|
|
42
|
-
| `Bool` | `true`, `false`
|
|
43
|
-
| `Unit` | the word `Unit`
|
|
37
|
+
| Type | Literal | In JavaScript |
|
|
38
|
+
| ------ | ------------------------ | ------------- |
|
|
39
|
+
| `Num` | `1`, `42`, `1.5`, `1e-3` | number |
|
|
40
|
+
| `Int` | `0n`, `42n`, `-42n` | `bigint` |
|
|
41
|
+
| `Str` | `"hi"`, `"a\nb"` | string |
|
|
42
|
+
| `Bool` | `true`, `false` | boolean |
|
|
43
|
+
| `Unit` | the word `Unit` | `undefined` |
|
|
44
44
|
|
|
45
45
|
`(Array a)` is an array. `(StrMap a)` is a dictionary with a string key. Bare digits are `Num`, an ordinary number in JavaScript. `Int` is written with the suffix `n` and becomes a `bigint`. In the examples below a number is `Num`. `1.0` is a number. `1.` is the number `1` and a separate dot. A string accepts `\\`, `\"`, `\n`, `\t`, and `\r`.
|
|
46
46
|
|
|
@@ -96,13 +96,13 @@ The same permutations as in Factor follow, with names made of letters: `dupd`, `
|
|
|
96
96
|
`cons` pushes a value and then runs a quotation. The value sits under the quotation, so `5 [ 1 add ] cons` is a quotation of type `(-- Num)` that pushes five and then adds one. The call site does not name that value.
|
|
97
97
|
|
|
98
98
|
```ply
|
|
99
|
-
~ "@plylang/prelude/Classes/
|
|
100
|
-
~ "@plylang/prelude/Classes/Subtractable"
|
|
99
|
+
~ "@plylang/prelude/Classes/Setoid" equal
|
|
100
|
+
~ "@plylang/prelude/Classes/Subtractable" sub
|
|
101
101
|
~ "@plylang/prelude/Classes/Arithmetic" multiply
|
|
102
102
|
~ "@plylang/prelude/Data/Num"
|
|
103
103
|
|
|
104
104
|
: fact ( Num -- Num )
|
|
105
|
-
dup 0 equal [ drop 1 ] [ dup 1
|
|
105
|
+
dup 0 equal [ drop 1 ] [ dup 1 sub fact multiply ] if
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
Zero is replaced by one. Otherwise `n` and `n - 1` remain on the stack, the recursive `fact` computes the second, and `multiply` multiplies.
|
|
@@ -192,7 +192,7 @@ The text between the angles is a program. It starts from an empty stack and does
|
|
|
192
192
|
A word that walks an array is imported. In the example the quotation sits on top. The name comes from one module, and the instance for the array comes from another.
|
|
193
193
|
|
|
194
194
|
```ply
|
|
195
|
-
~ "@plylang/prelude/Classes/
|
|
195
|
+
~ "@plylang/prelude/Classes/Functor" map
|
|
196
196
|
~ "@plylang/prelude/Classes/Arithmetic" add
|
|
197
197
|
~ "@plylang/prelude/Data/Num"
|
|
198
198
|
~ "@plylang/prelude/Data/Array"
|
|
@@ -259,10 +259,10 @@ The order in the example is the dictionary, the key, and the value on top.
|
|
|
259
259
|
```
|
|
260
260
|
|
|
261
261
|
```ply
|
|
262
|
-
~ "@plylang/prelude/Classes/
|
|
262
|
+
~ "@plylang/prelude/Classes/Setoid" Setoid, equal
|
|
263
263
|
~ "@plylang/prelude/Data/Num"
|
|
264
264
|
|
|
265
|
-
: same (
|
|
265
|
+
: same ( Setoid a => a a -- Bool )
|
|
266
266
|
equal
|
|
267
267
|
```
|
|
268
268
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plylang/plylang",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Ply compiler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Algosail",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"bin/native.js"
|
|
31
31
|
],
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@plylang/plylang-darwin-arm64": "1.1.
|
|
34
|
-
"@plylang/plylang-darwin-x64": "1.1.
|
|
35
|
-
"@plylang/plylang-linux-arm64": "1.1.
|
|
36
|
-
"@plylang/plylang-linux-x64": "1.1.
|
|
37
|
-
"@plylang/plylang-win32-arm64": "1.1.
|
|
38
|
-
"@plylang/plylang-win32-x64": "1.1.
|
|
33
|
+
"@plylang/plylang-darwin-arm64": "1.1.4",
|
|
34
|
+
"@plylang/plylang-darwin-x64": "1.1.4",
|
|
35
|
+
"@plylang/plylang-linux-arm64": "1.1.4",
|
|
36
|
+
"@plylang/plylang-linux-x64": "1.1.4",
|
|
37
|
+
"@plylang/plylang-win32-arm64": "1.1.4",
|
|
38
|
+
"@plylang/plylang-win32-x64": "1.1.4"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "cargo build --release",
|