18
18
- [ Status] ( #status )
19
19
- [ Installation] ( #installation )
20
20
- [ Dependencies] ( #dependencies )
21
+ - [ Usage examples] ( #usage-examples )
21
22
- [ API] ( #api )
22
23
- [ Authors] ( #authors )
23
24
- [ License] ( #license )
@@ -34,14 +35,27 @@ The core language is intentionally kept extremely minimal and currently only
34
35
contains the following:
35
36
36
37
- basic math ops (multi-arity)
38
+ - logic operators (multi-arity)
39
+ - ` and `
40
+ - ` or `
41
+ - ` not `
42
+ - bitwise operators
43
+ - ` << `
44
+ - ` >> ` / ` >>> `
45
+ - ` bit-and `
46
+ - ` bit-or `
47
+ - ` bit-xor `
48
+ - ` bit-not `
37
49
- comparison operators
38
50
- constants & functions from JS-native ` Math `
39
51
- selected utilities from [ thi.ng/math] ( https://thi.ng/math ) package
40
52
- ` HALF_PI `
41
53
- ` TAU `
42
54
- ` clamp ` : clamp value to interval
55
+ - ` deg ` : convert radians to degrees
43
56
- ` fit ` : fit value from one interval into another
44
57
- ` mix ` : linear interpolation (same as GLSL ` mix() ` )
58
+ - ` rad ` : convert degrees to radians
45
59
- ` step ` : same as GLSL ` step() `
46
60
- ` smoothstep ` : same as GLSL ` smoothstep() `
47
61
- basic FP programming constructs
@@ -51,6 +65,8 @@ contains the following:
51
65
- ` let ` : locally scope var bindings/expression
52
66
- ` partial ` : partial application (currying)
53
67
- basic list/array processing
68
+ - ` aget ` : get array index
69
+ - ` aset ` : set array index
54
70
- ` count ` : number of items
55
71
- ` concat ` : same as ` Array.prototype.concat(...) `
56
72
- ` filter ` : list/array filtering
@@ -98,7 +114,7 @@ For Node.js REPL:
98
114
const lispy = await import (" @thi.ng/lispy" );
99
115
```
100
116
101
- Package sizes (brotli'd, pre-treeshake): ESM: 1.30 KB
117
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.40 KB
102
118
103
119
## Dependencies
104
120
@@ -111,6 +127,16 @@ Package sizes (brotli'd, pre-treeshake): ESM: 1.30 KB
111
127
112
128
Note: @thi .ng/api is in _ most_ cases a type-only import (not used at runtime)
113
129
130
+ ## Usage examples
131
+
132
+ One project in this repo's
133
+ [ /examples] ( https://github.com/thi-ng/umbrella/tree/develop/examples )
134
+ directory is using this package:
135
+
136
+ | Screenshot | Description | Live demo | Source |
137
+ | :------------------------------------------------------------------------------------------------------------------| :----------------------------------------------------------| :-------------------------------------------------| :------------------------------------------------------------------------------|
138
+ | <img src =" https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/lispy-repl.png " width =" 240 " /> | Browser REPL for a Lispy S-expression based mini language | [ Demo] ( https://demo.thi.ng/umbrella/lispy-repl/ ) | [ Source] ( https://github.com/thi-ng/umbrella/tree/develop/examples/lispy-repl ) |
139
+
114
140
## API
115
141
116
142
[ Generated API docs] ( https://docs.thi.ng/umbrella/lispy/ )
@@ -160,6 +186,16 @@ evalExpressions(SRC, {...ENV, name: "lispy"});
160
186
// "<=": "<function>",
161
187
// ">=": "<function>",
162
188
// ">": "<function>",
189
+ // "and": "<function>",
190
+ // "or": "<function>",
191
+ // "not": "<function>",
192
+ // "<<": "<function>",
193
+ // ">>": "<function>",
194
+ // ">>>": "<function>",
195
+ // "bit-and": "<function>",
196
+ // "bit-or": "<function>",
197
+ // "bit-xor": "<function>",
198
+ // "bit-not": "<function>",
163
199
// "E": 2.718281828459045,
164
200
// "LN10": 2.302585092994046,
165
201
// "LN2": 0.6931471805599453,
@@ -203,11 +239,17 @@ evalExpressions(SRC, {...ENV, name: "lispy"});
203
239
// "tan": "<function>",
204
240
// "tanh": "<function>",
205
241
// "trunc": "<function>",
242
+ // "HALF_PI": 1.5707963267948966,
243
+ // "TAU": 6.283185307179586,
206
244
// "clamp": "<function>",
245
+ // "deg": "<function>",
207
246
// "fit": "<function>",
208
247
// "mix": "<function>",
248
+ // "rad": "<function>",
209
249
// "step": "<function>",
210
- // "smoothStep": "<function>",
250
+ // "smoothstep": "<function>",
251
+ // "aget": "<function>",
252
+ // "aset": "<function>",
211
253
// "push": "<function>",
212
254
// "concat": "<function>",
213
255
// "count": "<function>",
0 commit comments