functionalscript 0.0.283 → 0.0.284
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 +1 -1
- package/types/btree/find/index.js +67 -0
- package/types/list/test.js +9 -0
package/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const _ = require('..')
|
|
2
|
+
const { todo } = require('../../../dev')
|
|
3
|
+
const list = require('../../list')
|
|
4
|
+
const cmp = require('../../function/compare')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @template T
|
|
8
|
+
* @typedef {readonly[1, _.Leaf1<T>|_.Branch3<T>]} Found1
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @template T
|
|
13
|
+
* @typedef {readonly[1|3, _.Leaf2<T> | _.Branch5<T>]} Found2
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @template T
|
|
18
|
+
* @typedef {readonly[0|2, _.Leaf1<T>]} NotFound1
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @template T
|
|
23
|
+
* @typedef {readonly[0|2|4, _.Leaf2<T>]} NotFound2
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @template T
|
|
28
|
+
* @typedef {Found1<T> | Found2<T>} Found
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @template T
|
|
33
|
+
* @typedef {NotFound1<T> | NotFound2<T>} NotFound
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @template T
|
|
38
|
+
* @typedef {Found<T> | NotFound<T>} First
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @template T
|
|
43
|
+
* @typedef {readonly[0|2, _.Branch3<T>]} PathItem3
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @template T
|
|
48
|
+
* @typedef {readonly[0|2|4, _.Branch5<T>]} PathItem5
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @template T
|
|
53
|
+
* @typedef {PathItem3<T> | PathItem5<T>} PathItem
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @template T
|
|
58
|
+
* @typedef {list.List<PathItem<T>>} Path
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @template T
|
|
63
|
+
* @typedef {readonly[First<T>, Path<T>]} Result<T>
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>} */
|
|
67
|
+
const find = c => node => todo()
|
package/types/list/test.js
CHANGED
|
@@ -337,6 +337,15 @@ const stress = () => {
|
|
|
337
337
|
const len = _.length(_.dropWhile(() => true)(result))
|
|
338
338
|
if (len !== 0) { throw len }
|
|
339
339
|
}
|
|
340
|
+
|
|
341
|
+
console.log('reverse')
|
|
342
|
+
|
|
343
|
+
{
|
|
344
|
+
// 10_000_000 is too much
|
|
345
|
+
const n = 5_000_000
|
|
346
|
+
const result = _.toArray(_.reverse(_.countdown(n)))
|
|
347
|
+
if (result.length !== n) { throw result.length }
|
|
348
|
+
}
|
|
340
349
|
}
|
|
341
350
|
|
|
342
351
|
// stress()
|