@trebco/treb 32.3.1 → 32.3.3
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/dist/treb-spreadsheet.mjs +4 -4
- package/package.json +1 -1
- package/treb-calculator/src/expression-calculator.ts +10 -0
- package/treb-calculator/src/functions/fp.ts +34 -13
- package/treb-calculator/src/functions/gamma.ts +25 -4
- package/treb-calculator/src/functions/lambda-functions.ts +20 -0
- package/treb-embed/src/embedded-spreadsheet.ts +4 -0
- package/treb-export/src/xml-test.ts +47 -0
- package/treb-parser/package.json +1 -1
package/package.json
CHANGED
|
@@ -555,7 +555,17 @@ export class ExpressionCalculator {
|
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
case ValueType.undefined:
|
|
559
|
+
return {
|
|
560
|
+
type: 'missing', id: 0,
|
|
561
|
+
};
|
|
562
|
+
|
|
558
563
|
default:
|
|
564
|
+
|
|
565
|
+
// this (logging) is a problem in a simulation because
|
|
566
|
+
// it can bog down. we probably should only log once.
|
|
567
|
+
// or perhaps not at all?
|
|
568
|
+
|
|
559
569
|
console.warn('unhandled parameter value', arg);
|
|
560
570
|
|
|
561
571
|
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2024 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
3
20
|
*/
|
|
4
21
|
|
|
5
22
|
import type { FunctionMap } from '../descriptors';
|
|
@@ -86,10 +103,12 @@ export const FPFunctionLibrary: FunctionMap = {
|
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
const cols = data.value.length;
|
|
107
|
+
const rows = data.value[0].length;
|
|
108
|
+
|
|
109
|
+
for (let r = 0; r < rows; r++) {
|
|
110
|
+
for (let c = 0; c < cols; c++) {
|
|
111
|
+
const apply_args: UnionValue[] = [initial, data.value[c][r]];
|
|
93
112
|
const result = this.apply(lambda, apply_args)
|
|
94
113
|
initial = result;
|
|
95
114
|
}
|
|
@@ -137,16 +156,18 @@ export const FPFunctionLibrary: FunctionMap = {
|
|
|
137
156
|
}
|
|
138
157
|
|
|
139
158
|
const results: UnionValue[][] = [];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
const cols = data.value.length;
|
|
160
|
+
const rows = data.value[0].length;
|
|
161
|
+
|
|
162
|
+
for (let i = 0; i < cols; i++) { results.push([])}
|
|
163
|
+
|
|
164
|
+
for (let r = 0; r < rows; r++) {
|
|
165
|
+
for (let c = 0; c < cols; c++) {
|
|
166
|
+
const apply_args: UnionValue[] = [initial, data.value[c][r]];
|
|
145
167
|
const result = this.apply(lambda, apply_args)
|
|
146
|
-
|
|
168
|
+
results[c][r] = result;
|
|
147
169
|
initial = result;
|
|
148
170
|
}
|
|
149
|
-
results.push(results_row);
|
|
150
171
|
}
|
|
151
172
|
|
|
152
173
|
return {
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2024 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
5
20
|
*/
|
|
6
21
|
|
|
22
|
+
//
|
|
23
|
+
// functions and constants for gamma distribution. we're
|
|
24
|
+
// returning false instead of throwing so we can return
|
|
25
|
+
// a spreadsheet-style eror. TODO: optional?
|
|
26
|
+
//
|
|
27
|
+
|
|
7
28
|
const max_iterations = 1000;
|
|
8
29
|
const epsilon = 3.0e-9;
|
|
9
30
|
const min_value = 1.0e-30;
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2024 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
1
21
|
|
|
2
22
|
import type { FunctionMap } from '../descriptors';
|
|
3
23
|
import type { UnionValue} from 'treb-base-types';
|
|
@@ -841,6 +841,10 @@ export class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
|
|
|
841
841
|
// if we don't have a container. that's distinct (at the moment)
|
|
842
842
|
// from headless, which is a state that can change.
|
|
843
843
|
|
|
844
|
+
// what's the point of having the GridBase type if we're not using
|
|
845
|
+
// it when we don't have a container? or was it built for something
|
|
846
|
+
// else? (A: it was)
|
|
847
|
+
|
|
844
848
|
this.grid = new Grid(
|
|
845
849
|
grid_options,
|
|
846
850
|
this.model,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
export const attrs = Symbol('attrs');
|
|
3
|
+
export const text = Symbol('text');
|
|
4
|
+
|
|
5
|
+
export interface xml_node {
|
|
6
|
+
[attrs]?: Record<string, string>;
|
|
7
|
+
[text]?: string;
|
|
8
|
+
[index: string]: xml_node|xml_node[]|string|string[]|number|number[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const root: xml_node = {
|
|
12
|
+
|
|
13
|
+
[attrs]: { "zim": "zam", },
|
|
14
|
+
|
|
15
|
+
jim: {
|
|
16
|
+
[text]: "fish",
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
fish: "fish",
|
|
20
|
+
|
|
21
|
+
tacos: [
|
|
22
|
+
{
|
|
23
|
+
[text]: "al pastor",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
[text]: "carnitas",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ParseIt = (node: xml_node) => {
|
|
33
|
+
|
|
34
|
+
if (node[attrs]) {
|
|
35
|
+
// ...
|
|
36
|
+
}
|
|
37
|
+
if (node.gonas) {
|
|
38
|
+
if (Array.isArray(node.gonas)) {
|
|
39
|
+
//
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const t = typeof node.gonas;
|
|
43
|
+
console.info(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
};
|
package/treb-parser/package.json
CHANGED