- Add alloc.double_free detection to the .mq.md free-list allocator and a fixture assertion for a second free returning a recoverable Result. - Add table group fixture 69 (table.row -> Map of value lists). - Add Int matrix-multiply fixture 70 for C12 layout/iteration. - Update counts and P2 evidence/status docs. Gate: fmt, clippy -D warnings, 407 tests passed.
655 B
655 B
分组
(数据, 键列, 值列)
按文本键列分组,把值列聚合成 Map:键 -> List。输入表不变。
结果 = {}
行号 = 0
-
行号 < 长度(数据)行 = table.row(数据, 行号)
键 = 行[键列]
当前 = map.get(结果, 键)
列表 = []
-
map.has(结果, 键)列表 = 当前
-
true忽略 = 0
列表 = list.append(列表, 行[值列])
结果 = map.set(结果, 键, 列表)
行号 = 行号 + 1
-
结果
main
数据 = 表(["类别", "值"], "a", 1], ["b", 2], ["a", 3], ["b", 4], ["a", 5)
[数据, 分组(数据, 0, 1)]