-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommands.yml
498 lines (494 loc) · 14.6 KB
/
commands.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
commands:
- name: Map
arguments:
- name: array
type: mapping
- name: function
type: lambda-1-implicit
return: mapping
description: Apply a function to every element of a collection, and return the result. Result is lazy, function only executed when needed. Not nececairly executed in order. Side effect override this behavior.
- name: Filter
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: generator
description: Apply a function to every element, keeping only truthy elements. Result is lazy, function only executed when needed, but always in order. Side effect force immediate execution.
- name: Reduce
arguments:
- name: array
type: generator
- name: initial value
type: scalar
- name: function
type: lambda-2-implicit
return: scalar
description: apply a function to every pair of elements. Return the final result.
- name: Fold
arguments:
- name: array
type: generator
- name: function
type: lambda-2-implicit
return: scalar
description: apply a function to every pair of elements. Return the final result.
- name: Scan
arguments:
- name: array
type: generator
- name: initial value
type: scalar
- name: function
type: lambda-2-implicit
return: scalar
description: Map with state. Function should return a array of 2 elements, the second will be passed as the second argument to the next iteration.
- name: Successors
arguments:
- name: initial value
type: scalar
- name: function
type: lambda-1-implicit
return: generator
description: Repeatedly apply a function to a initial value, returning a infinite generator of each intermediate value.
- name: Fixed Point
arguments:
- name: initial value
type: scalar
- name: function
type: lambda-1-implicit
return: scalar
description: Repeatedly apply a funnction to it's own output till the result stops changing, then return that value. May cause infinte loop if the function does not converge.
- name: Take While
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: generator
description: Truncate the list to before the first element so that f(x) returns a fasly value.
- name: Any
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: boolean
description: return True if for any x in the array f(x) returns a truthy value. May loop infinitely for a infinitely sized array that's all false.
- name: All
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: boolean
description: return False if for any x in the array f(x) returns a falsy value. May loop infinitely for a infinitely sized array that's all true.
- name: Length
arguments:
- name: array
type: array
return: integer
description: return the length of a list. Generators or mappings may need to be converted to lists, which will fully evaluate them.
- name: First
arguments:
- name: generator
type: generator
return: scalar
description: Return the first value of a array
- name: Last
arguments:
- name: array
type: array
return: scalar
description: Return the last value of a array
- name: Nth
arguments:
- name: array
type: array
- name: index
type: integer
return: scalar
description: return the nth element of a array. Negativee values wrap to the end of the array. Negative elements thus require a array of finite length.
- name: Slice
arguments:
- name: array
type: array
- name: start
type: integer
- name: end
type: integer
return: generator
description: slize a subsequence from a array. Start and end are both inclusive. Negative values wrap.
- name: Sum
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: scalar
description: Sum f(x) for every value in the array
- name: All Equal
arguments:
- name: array
type: generator
- name: function
type: lambda-1-implicit
return: boolean
description: If f(x) is equal for all element of the array
- name: Average
arguments:
- name: array
type: generator
return: scalar
description: the sum divided by the length
- name: Median
arguments:
- name: array
type: generator
return: scalar
description: Sort the array and return the middle element.
- name: Mode
arguments:
- name: array
type: generator
return: scalar
description: Return the most common element in a generator. In case of a tie the first element is returned.
- name: Truncate
arguments:
- name: array
type: generator/mapping
- name: max
type: integer
return: generator
description: Limit a array to max N elements
- name: Chain
arguments:
- name: array1
type: generator
- name: array2
type: generator
return: generator
description: concatenate 2 arrays
- name: FlattenOnce
arguments:
- name: array
type: generator
return: generator
description: Flatten (once) a generator of generators
- name: FlattenN
arguments:
- name: array
type: generator
- name: N
type: integer
return: generator
description: flatten a generator, then recurisvely flatten each element up to a depth of N.
- name: Delete Nth
arguments:
- name: array
type: generator/mapping
- name: index
type: integer
return: generator/mapping
description: delete the Nth element of a collection, returns a new list with all elements
fter N shifted 1 to the left.
- name: Replace Nth
arguments:
- name: array
type: mapping
- name: N
type: integer
- name: replacement
type: scalar
return: mapping
descritption: Return a new array that replaces the Nth element with replacement.
- name: Insert at N
arguments:
- name: array
type: mapping
- name: N
type: integer
- name: value
type: scalar
return: mapping
description: Return a new array that inserts value in position N, moving all values after N to the right
- name: Prepend
arguments:
- name: array
type: generator/mapping
- name: value
type: scalar
return: generator/mapping
description: Return a new array which has value as it's first element and array as all the rest
- name: Append
arguments:
- name: array
type: generator
- name: value
type: scalar
return: generator
descritption: Return a new generator with value inserted at the end
- name: Delete Range
arguments:
- name: array
type: generator/mapping
- name: start
type: integer
- name: end
type: integer
return: generator/mapping
description: Return a new generator with the given range removed.
- name: Replace Range
arguments:
- name: array
type: generator/mapping
- name: start
type: integer
- name: end
type: integer
- name: replacement
type: array
return: mapping/generator
description: Replace the range given by start/end with a new range
- name: Delete First Equals
arguments:
- name: array
type: generator
- name: value
type: scalar
return: generator
- name: Delete All Equals
arguments:
- name: array
type: generator
- name: value
type: scalar
return: generator
description: Return a generator with all items equal to value removed
- name: Chunks
arguments:
- name: array
type: generator/mapping
- name: chunk size
type: integer
return: generator
description: Return a array of arrays, each being a slice of chunk size. Each chunk ends right before the next one starts.
- name: Chunks Overlapping
arguments:
- name: array
type: generator/mapping
- name: chunk size
type: integer
return: generator
description: Return a array of arrays, each chunk size long. The start of each array is offset by 1, thus the chunks will overlap.
- name: Transpose
arguments:
- name: array
type: array
return: generator
description: Given a array of arrays return a array that iterates over the first of each subarray, then the second etc.
- name: Zip
arguments:
- name: array_1
type: generator/mapping
- name: array_2
type: generator/mapping
return: generator/mapping
descritpion: Given 2 array return a generator of pairs of values, one from each
- name: MultiSetUnion
arguments:
- name: array_1
type: array
- name: array_2
type: array
return: generator
description: Each element will appear max(a,b) times where a is how often it appears in array_1 and b is how often it appears in array_2
- name: MultiSetIntersection
arguments:
- name: array_1
type: array
- name: array_2
type: array
return: generator
description: Each element will appear min(a,b) times where a is how often it appears in array_1 and b is how often it appears in array_2
- name: MultiSetDifference
arguments:
- name: array_1
type: array
- name: array_2
type: array
return: array
description: Each element will appear max(0,a-b) times where a is how often it appears in array_1 and b is how often it appears in array_2
- name: Sort
arguments:
- name: array
type: array
return: array
description: Sort a array in lexicographical order
- name: Sort reverse
arguments:
- name: array
type: array
return: array
description: Sort a array in reverse lexicographical order
- name: Sort by key
arguments:
- name: array
type: array
- name: function
type: lambda-1-implicit
description: Sort a array by the result of applying the function to each element
- name: Intersperse
arguments:
- name: array
type: generator
- name: value
type: scalar
description: Return a new array with scalar inserted between each 2 elements.
- name: Uniquefy
arguments:
- name: array
type: array
return: array
description: Return a array where each element that appeared multiple times now appears once
- name: Reverse
arguments:
- name: array
type: array
return: array
description: Return a array which is the source reversed
- name: Rotate
arguments:
- name: array
type: array
- name: amount
type: integer
return: array
description: rotate the array N times, moving each element right and moving items from the end to the start. If N is negative rotate left instead.
- name: Range
arguments:
- name: end
type: integer
return: generator
description: Create a range 1-N inclusivee
- name: RangeFromTo
arguments:
- name: start
type: integer
- name: end
type: integer
return: genrator
description: Return a generator from start to end inclusive
- name: RangeFromToExclusive
arguments:
- name: start
type: integer
- name: end
type: integer
return: genrator
description: Return a generator from start to end excluding the end
- name: InfiniteRange
arguments: []
return: generator
description: Return the singleton infinite generator from 1 up to infinity.
- name: RangeWithStep
arguments:
- name: start
type: integer
- name: end
type: integer
- name: step
type: integer
return: generator
description: Return a generator from start to end excluding the end. Move by step each time.
- name: RepeatScalar
arguments:
- name: scalar
type: scalar
return: generator
description: Return a infinite generator where every element is scalar
- name: single
arguments:
- name: scalar
type: scalar
return: array
description: Return a array with one element the scalar
- name: Pair
arguments:
- name: scalar 1
type: scalar
- name: scalar 2
type: scalar
return: array
description: Return a array with 2 elements, scalar 1 and scalar 2
- name: Combinations
arguments:
- name: array
type: array
- name: N
type: integer
return: generator
description: Return a array of all combinations of array of length N, preserving orignal order.
- name: Permu tations
arguments:
- name: array
type: array
- name: N
type: integer
return: generator
description: Return a generator of all orderings of any subset of length N of array
- name: Cartesian Product
arguments:
- name: array 1
type: array
- name: array 2
type: array
return: generator
description: Return all possible combinations of a and b, as a array of pairs
- name: Cartesian Power
arguments:
- name: array
type: array
- name: N
type: integer
return: generator
description: Return a array of all possible combinations of a array with itself of length N
- name: Subsequences
arguments:
- name: array
type: array
return: generator
description: Return a generator of all subsequences of array
- name: Add
arguments:
- name: operand 1
type: number
- name: operand 2
type: number
- name: Subtract
arguments:
- name: operand 1
type: number
- name: operand 2
type: number
# More operators skipped for now
- name: If
arguments:
- name: condition
type: number
- name: if-true
type: lambda-0-implicit
- name: if-false
type: lambda-0-implicit
return: scalar
description: Returns the if-true case if the argument is truthy, otherwise false
## Variables
- name: 1st Variable
arguments: []
return: scalar
- name: 2nd Variable
arguments: []
return: scalar
- name: 3rd Variable
arguments: []
return: scalar