diff --git a/ext/quantum/quantum.mq.md b/ext/quantum/quantum.mq.md index 8d5f2f5..54cdebd 100644 --- a/ext/quantum/quantum.mq.md +++ b/ext/quantum/quantum.mq.md @@ -174,13 +174,10 @@ Circuit rail / probability bars / Bloch sphere SVG (`kind=circuit|probs|bloch`). + `theta`=None + `matrix`=None -Named built-in gate (`name=H`) or custom unitary from `matrix=` (nested list / `$$` matrix fence). Optional `name=` label for custom gates (default `U`). +Named built-in gate (`name=H`) or custom unitary from `matrix=` (nested list or formula matrix fence). Optional `name=` label for custom gates (default `U`). > ensure_plugin -1. `matrix` - **> quantum_gate_from_matrix matrix=`matrix` name=`name`** -2. * - **> quantum_gate_new name=`name` theta=`theta`** +**> quantum_gate_new name=`name` theta=`theta` matrix=`matrix`** ## matrix diff --git a/ext/quantum/量子.mq.md b/ext/quantum/量子.mq.md index af3720a..2febc0f 100644 --- a/ext/quantum/量子.mq.md +++ b/ext/quantum/量子.mq.md @@ -174,13 +174,10 @@ description: 官方量子电路模拟(中文)。门 + 电路;ABI 插件。 + `参数`=None + `矩阵`=None -具名内置门(`名=H`)或由 `矩阵=`(嵌套 list / `$$` 矩阵围栏)定义的自定义酉门。自定义门可选 `名=`(默认 `U`)。 +具名内置门(`名=H`)或由 `矩阵=`(嵌套 list 或公式矩阵围栏)定义的自定义酉门。自定义门可选 `名=`(默认 `U`)。 > 确保插件 -1. `矩阵` - **> quantum_gate_from_matrix matrix=`矩阵` name=`名`** -2. * - **> quantum_gate_new name=`名` theta=`参数`** +**> quantum_gate_new name=`名` theta=`参数` matrix=`矩阵`** ## 矩阵 diff --git a/plugins/quantum/src/lib.rs b/plugins/quantum/src/lib.rs index d921d78..8bfe001 100644 --- a/plugins/quantum/src/lib.rs +++ b/plugins/quantum/src/lib.rs @@ -668,10 +668,11 @@ pub unsafe extern "C" fn marqdo_plugin_init(host: *const MarqdoHostApi) -> c_int "circuit,path,kind,qubit", quantum_draw_circuit as PluginFn, ), - ("quantum_gate_new", "name,theta,matrix", quantum_gate_new as PluginFn), + // `matrix` is optional (custom unitary); omit from required bind list. + ("quantum_gate_new", "name,theta", quantum_gate_new as PluginFn), ( "quantum_gate_from_matrix", - "matrix,name", + "matrix", quantum_gate_from_matrix as PluginFn, ), ( diff --git a/public/00-welcome-plot-1.svg b/public/00-welcome-plot-1.svg new file mode 100644 index 0000000..ae318f6 --- /dev/null +++ b/public/00-welcome-plot-1.svg @@ -0,0 +1,17 @@ + + + + + + + +xy-3-2-1123-22460 + \ No newline at end of file diff --git a/public/00-欢迎-plot-1.svg b/public/00-欢迎-plot-1.svg new file mode 100644 index 0000000..ae318f6 --- /dev/null +++ b/public/00-欢迎-plot-1.svg @@ -0,0 +1,17 @@ + + + + + + + +xy-3-2-1123-22460 + \ No newline at end of file diff --git a/public/features/05-extensions.mq.md b/public/features/05-extensions.mq.md index cd4ce8c..8fdd705 100644 --- a/public/features/05-extensions.mq.md +++ b/public/features/05-extensions.mq.md @@ -28,11 +28,18 @@ marqdo ext add web marqdo ext add quantum ``` -- ext/llm — OpenAI-compatible chat. Design: doc/design/ext-llm.md -- ext/agent — agent framework + native plugin. Design: doc/design/ext-agent.md -- ext/web — HTTP / SQLite site helpers + native plugin. Design: doc/design/ext-web.md -- ext/quantum — circuits, draw, noise, formula `matrix=` custom gates. Design: doc/design/ext-quantum.md -- Installer: marqdo ext list / add / remove — doc/design/ext-cli.md -- Native plugins: lib/plugin + include/marqdo_abi.h — doc/design/ext-abi.md +Packages (not Markdown list markers — those are loops in Marqdo): + +ext/llm — OpenAI-compatible chat. Design: doc/design/ext-llm.md + +ext/agent — agent framework + native plugin. Design: doc/design/ext-agent.md + +ext/web — HTTP / SQLite site helpers + native plugin. Design: doc/design/ext-web.md + +ext/quantum — circuits, draw, noise, formula matrix custom gates. Design: doc/design/ext-quantum.md + +Installer: marqdo ext list / add / remove — doc/design/ext-cli.md + +Native plugins: lib/plugin + include/marqdo_abi.h — doc/design/ext-abi.md > print text=ext-ok diff --git a/public/features/05-扩展.mq.md b/public/features/05-扩展.mq.md index ec29e55..f92603e 100644 --- a/public/features/05-扩展.mq.md +++ b/public/features/05-扩展.mq.md @@ -28,11 +28,18 @@ marqdo ext add web marqdo ext add quantum ``` -- ext/llm(大模型)— OpenAI 兼容聊天。设计:doc/design/ext-llm.md -- ext/agent(智能体)— 智能体框架 + 原生插件。设计:doc/design/ext-agent.md -- ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件。设计:doc/design/ext-web.md -- ext/quantum(量子)— 电路、绘图、噪声、公式 `矩阵=` 自定义门。设计:doc/design/ext-quantum.md -- 安装器:marqdo ext list / add / remove — doc/design/ext-cli.md -- 通用原生插件:lib/plugin + include/marqdo_abi.h — doc/design/ext-abi.md +扩展包(勿用 Markdown `-` 列表:在 Marqdo 里 `-` 是循环): + +ext/llm(大模型)— OpenAI 兼容聊天。设计:doc/design/ext-llm.md + +ext/agent(智能体)— 智能体框架 + 原生插件。设计:doc/design/ext-agent.md + +ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件。设计:doc/design/ext-web.md + +ext/quantum(量子)— 电路、绘图、噪声、公式矩阵自定义门。设计:doc/design/ext-quantum.md + +安装器:marqdo ext list / add / remove — doc/design/ext-cli.md + +通用原生插件:lib/plugin + include/marqdo_abi.h — doc/design/ext-abi.md > 打印 内容=扩展就绪 diff --git a/public/features/06-quantum-plot-1.svg b/public/features/06-quantum-plot-1.svg new file mode 100644 index 0000000..6409a88 --- /dev/null +++ b/public/features/06-quantum-plot-1.svg @@ -0,0 +1 @@ +100000.501110.50 \ No newline at end of file diff --git a/public/features/06-quantum-plot-2.svg b/public/features/06-quantum-plot-2.svg new file mode 100644 index 0000000..2091dae --- /dev/null +++ b/public/features/06-quantum-plot-2.svg @@ -0,0 +1 @@ +H matrix000.7070.707110.707-0.707 \ No newline at end of file diff --git a/public/features/06-量子-plot-1.svg b/public/features/06-量子-plot-1.svg new file mode 100644 index 0000000..6409a88 --- /dev/null +++ b/public/features/06-量子-plot-1.svg @@ -0,0 +1 @@ +100000.501110.50 \ No newline at end of file diff --git a/public/features/06-量子-plot-2.svg b/public/features/06-量子-plot-2.svg new file mode 100644 index 0000000..2091dae --- /dev/null +++ b/public/features/06-量子-plot-2.svg @@ -0,0 +1 @@ +H matrix000.7070.707110.707-0.707 \ No newline at end of file diff --git a/public/keywords/内核双名.mq.md b/public/keywords/内核双名.mq.md index 1d165c3..f6c4391 100644 --- a/public/keywords/内核双名.mq.md +++ b/public/keywords/内核双名.mq.md @@ -7,7 +7,7 @@ description: 无需导入:打印、长度、文本、整数 与 print / len / 内核中英别名等价,可混用: -*`s` = 你好* +*`s` = "你好"* *`n` = > 长度 值=`s`* diff --git a/public/keywords/标准库.mq.md b/public/keywords/标准库.mq.md index bbfc988..0d7e223 100644 --- a/public/keywords/标准库.mq.md +++ b/public/keywords/标准库.mq.md @@ -7,7 +7,7 @@ description: 主机内置;中文别名覆盖常用几个 长度与英文 `type`(类型无中文内核别名,见标准库文档): -*`s` = 你好* +*`s` = "你好"* *`n` = > 长度 值=`s`* diff --git a/public/stdlib/math-plot-1.svg b/public/stdlib/math-plot-1.svg new file mode 100644 index 0000000..ae318f6 --- /dev/null +++ b/public/stdlib/math-plot-1.svg @@ -0,0 +1,17 @@ + + + + + + + +xy-3-2-1123-22460 + \ No newline at end of file diff --git a/public/stdlib/plugin.mq.md b/public/stdlib/plugin.mq.md index c7c31ae..cda5447 100644 --- a/public/stdlib/plugin.mq.md +++ b/public/stdlib/plugin.mq.md @@ -8,7 +8,7 @@ description: Load optional shared libraries (.dll / .so / .dylib) Import lib/plugin.mq.md. Functions: load(path), unload(), list(). After load, registered plugin names are callable like other functions. C ABI: include/marqdo_abi.h — see doc/design/ext-abi.md. Path must stay under the program sandbox (cwd / fs root). -*`names` = > list * +*`names` = > plugin.list * *`n` = > len `names` * diff --git a/public/stdlib/subtask.mq.md b/public/stdlib/subtask.mq.md index 0780863..9826ecb 100644 --- a/public/stdlib/subtask.mq.md +++ b/public/stdlib/subtask.mq.md @@ -6,15 +6,15 @@ description: Spawn file, function, or foreign code in parallel # main -`spawn` picks **one** mode (others default to `None`): +spawn picks one mode (others default to None): -| Argument | Runs | `wait` returns | +| Argument | Runs | wait returns | |----------|------|----------------| -| `path=` | `marqdo run` child process | exit code | -| `fn=` + optional `args=` | function in a thread (entry module) | return value | -| `code=` | foreign ``` fence ``` subprocess | stdout text | -| `lang=` + `source=` | foreign source subprocess | stdout text | +| path= | marqdo run child process | exit code | +| fn= + optional args= | function in a thread (entry module) | return value | +| code= | foreign fence subprocess | stdout text | +| lang= + source= | foreign source subprocess | stdout text | -File children are silent unless `quiet=False`. Also: `poll id=`, `kill id=`, `wait_all`. Parent exit kills file/foreign children. +File children are silent unless quiet=False. Also: poll id=, kill id=, wait_all. Parent exit kills file/foreign children. > print text=subtask overview ok diff --git a/public/stdlib/sys.mq.md b/public/stdlib/sys.mq.md index 80e4455..e5f7f15 100644 --- a/public/stdlib/sys.mq.md +++ b/public/stdlib/sys.mq.md @@ -8,7 +8,7 @@ description: Env, dotenv, cwd, args, exit, exec Import lib/sys.mq.md. Functions: env_get, env_set, load_dotenv(optional path), args, cwd, exit(code), exec(cmd), stream_publish(event). load_dotenv does not override existing variables. Under view, exit soft-fails instead of killing the process. `stream_publish` feeds the view SSE EventBus. -*`d` = > cwd * +*`d` = > sys.cwd * *`n` = > len `d` * diff --git a/public/stdlib/writeback.mq.md b/public/stdlib/writeback.mq.md index 44bf8ef..1fd07f0 100644 --- a/public/stdlib/writeback.mq.md +++ b/public/stdlib/writeback.mq.md @@ -8,8 +8,10 @@ description: Persist run output in the entry .mq.md file Writeback stores output in `` blocks in the **entry** file (the one you run). -- `record value=` — default: insert or replace the block **below the call**; `at_end=true` → single block at EOF -- `get` / `clear` — read or remove the adjacent block (or EOF block when `at_end=true`) -- `list` — all output blocks in the entry file +record value= — default: insert or replace the block below the call; at_end=true → single block at EOF. + +get / clear — read or remove the adjacent block (or EOF block when at_end=true). + +list — all output blocks in the entry file. > print text=writeback overview ok diff --git a/public/stdlib/子任务.mq.md b/public/stdlib/子任务.mq.md index 2fa0354..b10450e 100644 --- a/public/stdlib/子任务.mq.md +++ b/public/stdlib/子任务.mq.md @@ -6,15 +6,15 @@ description: 文件、函数或外联代码并行执行 # main -`启动`(`spawn`)四选一(其余参数默认 `None`): +启动(spawn)四选一(其余参数默认 None): -| 参数 | 方式 | `等待` 返回 | +| 参数 | 方式 | 等待 返回 | |------|------|-------------| -| `路径=` | `marqdo run` 子进程 | 退出码 | -| `函数=` + 可选 `参数=` | 入口模块中的函数(线程) | 返回值 | -| `代码=` | 外联代码块子进程 | stdout 文本 | -| `语言=` + `源码=` | 外联源码子进程 | stdout 文本 | +| 路径= | marqdo run 子进程 | 退出码 | +| 函数= + 可选 参数= | 入口模块中的函数(线程) | 返回值 | +| 代码= | 外联代码块子进程 | stdout 文本 | +| 语言= + 源码= | 外联源码子进程 | stdout 文本 | -文件子任务默认静默;`静默=假` 时继承父终端。另有:`探测`、`终止`、`等待全部`。父进程结束会终止文件/外联子进程。 +文件子任务默认静默;静默=假 时继承父终端。另有:探测、终止、等待全部。父进程结束会终止文件/外联子进程。 > 打印 内容=子任务总览就绪 diff --git a/public/stdlib/插件.mq.md b/public/stdlib/插件.mq.md index 1dbbbaa..5bfc89f 100644 --- a/public/stdlib/插件.mq.md +++ b/public/stdlib/插件.mq.md @@ -8,7 +8,7 @@ description: 加载可选共享库(.dll / .so / .dylib) 导入 lib/插件.mq.md。函数:加载(路径)、卸载()、列出()。加载后,插件注册的名称可像普通函数一样调用。C 契约见 include/marqdo_abi.h 与 doc/design/ext-abi.md。路径须落在程序沙箱内。 -*`names` = > 列出 * +*`names` = > 插件.列出 * *`n` = > 长度 值=`names` * diff --git a/public/stdlib/数学-plot-1.svg b/public/stdlib/数学-plot-1.svg new file mode 100644 index 0000000..ae318f6 --- /dev/null +++ b/public/stdlib/数学-plot-1.svg @@ -0,0 +1,17 @@ + + + + + + + +xy-3-2-1123-22460 + \ No newline at end of file diff --git a/public/stdlib/文件.mq.md b/public/stdlib/文件.mq.md index fbc2615..f9c6064 100644 --- a/public/stdlib/文件.mq.md +++ b/public/stdlib/文件.mq.md @@ -10,7 +10,7 @@ description: 沙箱内读写文本 裸路径字面量不要写斜杠(会被当成除法)。可用同目录文件名或变量。 -*`ok` = > 存在 路径=demo.txt * +*`ok` = > 文件.存在 路径=demo.txt * 1. `ok` > 打印 内容=有演示文件 diff --git a/public/stdlib/系统.mq.md b/public/stdlib/系统.mq.md index 0d99b2e..035b429 100644 --- a/public/stdlib/系统.mq.md +++ b/public/stdlib/系统.mq.md @@ -8,7 +8,7 @@ description: 环境变量、dotenv、工作目录、参数、退出、执行 导入 lib/系统.mq.md。函数:取环境、设环境、加载环境(可选路径)、参数表、工作目录、退出(码)、执行(命令)。加载环境不覆盖已有变量。view 下退出会软失败,不结束进程。 -*`d` = > 工作目录 * +*`d` = > 系统.工作目录 * *`n` = > 长度 值=`d` * diff --git a/public/stdlib/自写回.mq.md b/public/stdlib/自写回.mq.md index 1cd3620..1512f85 100644 --- a/public/stdlib/自写回.mq.md +++ b/public/stdlib/自写回.mq.md @@ -6,10 +6,12 @@ description: 把运行结果写回入口 .mq.md # main -自写回把结果写入入口文件(你 `run` 的那份 `.mq.md`)里的 `` 块。 +自写回把结果写入入口文件(你 run 的那份 .mq.md)里的 marqdo-out 注释块。 -- `记录 内容=`(`record`)— 默认写在调用下方;`at_end=真` 则在文件末尾单独一块 -- `读取` / `清除` — 读或删相邻块(`at_end` 时指 EOF 块) -- `列表` — 列出文件中所有输出块 +记录 内容=(record)— 默认写在调用下方;at_end=真 则在文件末尾单独一块。 + +读取 / 清除 — 读或删相邻块(at_end 时指 EOF 块)。 + +列表 — 列出文件中所有输出块。 > 打印 内容=自写回总览就绪