- Add stdlib/data/table.mq.md with select/filter/sort/append/set-cell/join/ group as value-returning .mq.md functions over table.columns/row/cell. - Keep Value::Table logical semantics, GFM AST laziness and T0 physical storage unchanged; no new table builtin or HostOp (ADR-0032). - Add stdlib/tests/table.mq.md and a CLI test asserting shapes/order and input immutability; refresh the bundle digest. - Update architecture/status/spec/README/changelog and evidence. Gate: fmt, clippy -D warnings, 420 tests passed.
2.7 KiB
2.7 KiB
RFC-CM CM-A08 evidence: table logical value and stdlib algorithms
Date: 2026-11-20 (Asia/Shanghai)
Repository: marqdo-cli
Baseline: 49910ec plus this step's changes.
Decision record: ADR-0032
Related: P2 table fixtures, STATUS §5.
Scope: logical Value::Table + stdlib algorithms; no physical migration.
Environment and gate
Ubuntu 26.04 development container, Linux x86_64, Rust 1.100.0.
cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS
cargo test --workspace --locked PASS
420 passed, 0 failed, 2 ignored (existing plugin-sdk doc-tests)
No GitHub CI is available from this checkout; this is local evidence.
Layers
- GFM source: unchanged parser/AST/laziness.
- Logical value:
Value::Tablekeeps ordered headers/rows, width validation, equality/display/wire and copy (no aliasing). - Physical storage: T0
Vec<Vec<Value>>, unchanged and private to the implementation; T1/T2/T3 are explicitly not done.
Stdlib module
stdlib/data/table.mq.md (import std:data/table):
选择列(数据, 列)
过滤数值大于(数据, 列, 阈值)
排序(数据, 列) / 插入有序(...)
追加行(数据, 行)
设置单元格(数据, 目标行, 目标列, 值)
连接(左, 右, 左列, 右列)
分组(数据, 键列, 值列)
All are .mq.md functions using table.columns/row/cell, list.*, map.*
and 表. Every result is a new value; inputs are never mutated.
Self-test
stdlib/tests/table.mq.md:
data = [名称,分数]: 甲87, 乙92, 丙71
选择列(1) -> header [分数]
过滤 >80 -> 甲87, 乙92
排序(1) -> 丙71, 甲87, 乙92
追加行(丁65) -> 4 rows
设置单元格(0,1,99) -> 甲99
连接(左,右,0,0) -> 2 matched rows, 4 columns
分组(类别,值) -> {a:[1,3], b:[2]}
original data -> unchanged
crates/cli/tests/stdlib_table.rs runs it through the CLI with
MARQDO_STDLIB_DIR and asserts every shape/order plus input immutability.
Not done
- No T1 controlled storage interface, T2 column store, T3 views, or Memory-backed numeric columns.
- No
DataFrame/TableViewvalue types; no mutable table operations. - No generic mixed-type sort/group beyond the explicit numeric/Text contracts.
- No change to GFM parsing, rendering, spans or references.
- No external stdlib repository publication and no Windows/macOS evidence.
Reproduce
export PATH=/root/.cargo/bin:$PATH
export CARGO_HOME=/root/work/marqdo-cli/.cache/cargo
export CARGO_TARGET_DIR=/root/work/marqdo-cli/.cache/target
cargo test -p marqdo-cli --test stdlib_table
cargo test --workspace --locked