Native analysis and an explicit Intl formatting boundaryok
文档
怎样读这份可执行文档
正文说明意图,标记指出哪些片段会执行。遮蔽只在正文显示动作说明,实际逻辑放在侧注;阅读、展开与定位都不会运行代码。
| 标记 | 阅读含义 |
|---|---|
无标记文字 | 作者的解释,按普通 Markdown 阅读。 |
空行 | 分隔叙述与结构,不是计算步骤。 |
# / ## | 一级标题声明对象或入口,更深标题声明函数;说明按钮可查看输入、返回与依据。 |
> | 调用函数;实际执行结果另有标注。 |
1. 递增 | 按条件选择分支,不是普通编号说明。 |
- | 重复或遍历结构;迭代选择器只切换已有运行记录。 |
+ `名` | 兼容的显式形参;新库优先在叙述中声明参数,标题下的表格解释契约。 |
GFM 表 | 未绑定的契约表是说明;绑定表按列、行和 @ 形态构成数据。 |
```lang | 代码块;绑定的外语代码与普通示例区分展示,数学公式另有公式卡片。 |
--- / *** | 分隔内容,不能把分隔线当作函数返回。 |
<!-- marqdo-out --> | 程序写回的结果,区别于作者原始正文。 |
`名` | 叙述中的参数或变量;默认值跟在名称之后。 |
**…** | 执行语句:赋值、调用或计算;不是打印,也不是返回。 |
*…* | 返回表达式;句中以返回、Return 等明确引出。 |
*None* / **** | 显式返回空值或结束当前函数。 |
[键](集合) | 正文显示描述,侧注按函数与参数、可跳转链接、结构化内容展示括号内的细节;空括号表示待补充实际逻辑。阅读不会执行调用。classic 模式保留旧链接取元。 |
修饰… [函数] … | 兼容的带修饰调用;不能把任意普通链接当作执行授权。 |
集合[^键] | 兼容的脚注取元;当前库优先用 access 读取集合。 |
*仅* / **说明** | 普通强调仍属于文字;界面按真实解析结果区分强调、语句与返回。 |
This page keeps order analysis in Marqdo and uses Node Intl only for locale-aware currency formatting. Read the actual native report tools for their independently callable input and return contracts. That single module contains grouping, population statistics and the bounded persistent formatter.
跳转链接the actual native report tools
原始写法
../../examples/foreign-native-report/index.mq.mdCall this page's main with process.exec for a full workflow, or call analyze_orders in that module with no effects for native analysis alone. View evaluates the same cells with shared state and isolated kernels. No Python interpreter is needed.
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | View-session plan plus the native report and checked localized formatting |
This complete page uses six ordinary orders: their native total is 950, count is six, and the four regional rows retain count, total, mean and normalized span. The pure analysis is independently callable in the linked module. Formatting is a separate capability with an explicit process.exec grant and an installed Node runtime. The successful return contains report and formatting alongside the view-session plan; it contains no live kernel handle and can be returned by marqdo call.
The view gets the same native report copied into two named kernels. Its cells perform presentation rather than reimplementing native grouping or arithmetic.
cell reuses it. The review kernel receives its own report copy and formatter. This demonstrates both shared state and kernel isolation. Running the dependent formatting cell before its initializer should show the real missing-state error.
Static View export evaluates those same cells and embeds actual stdout. Interactive View retains their kernels for later runs. The low-level formatter used to check the public return is opened and closed separately, so it cannot secretly supply state to the view kernels. No stdin, notebook command, generated file-reader program or package installation is hidden in this example. If Node or formatting fails, the page returns that failure before declaring a ready view. Native-only consumers can still call analyze_orders with no effects. The table cells below are data, while the three bound node fences are explicit foreign code. The distinction is visible without translating a Python workflow into another ad hoc command sequence.
| @ | region | amount |
|---|---|---|
| 1 | 华东 | 120 |
| 2 | 华东 | 300 |
| 3 | 华南 | 90 |
| 4 | 华南 | 140 |
| 5 | 华北 | 220 |
| 6 | 西部 | 80 |
函数调用Perform all analysis in Marqdo
native.analyze_orders- orders
`orders`
原始写法
native.analyze_orders(orders=`orders`)函数调用Use the genuine external formatting boundary
native.format_summary- report
`report`
原始写法
native.format_summary(report=`report`)- not access(formatted, "ok")Return formatted before declaring an executable view ready.
| @ | 名称 | 语言 |
|---|---|---|
| 1 | 分析 | node |
| 2 | 复核 | node |
| @ | 单元 | 内核 |
|---|---|---|
| 1 | 计算 | 分析 |
| 2 | 格式化 | 分析 |
| 3 | 复核 | 复核 |
| @ | 内核 | 名称 | 值 |
|---|---|---|---|
| 1 | 分析 | report | report |
| 2 | 复核 | report | report |
函数调用Declare the view with native values and explicit kernels
foreign.session- kernels
`kernels`- cells
`cells`- values
`initial`
原始写法
foreign.session(kernels=`kernels`, cells=`cells`, values=`initial`)var money = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"});
console.log(JSON.stringify(report));
{"average":158.33333333333334,"count":6,"regions":[{"mean":210,"orders":2,"region":"华东","total":420,"z_span":1},{"mean":220,"orders":1,"region":"华北","total":220,"z_span":0},{"mean":115,"orders":2,"region":"华南","total":230,"z_span":1},{"mean":80,"orders":1,"region":"西部","total":80,"z_span":0}],"total":950}
— 9ms
console.log(money.format(report.total));
console.log(money.format(report.average));
CN¥950.00 CN¥158.33
var reviewMoney = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"});
console.log(JSON.stringify({count:report.count, total:reviewMoney.format(report.total)}));
{"count":6,"total":"CN¥950.00"}
— 10ms
函数调用Retain the checked persistent-kernel result
access- 参数 1
`formatted`- 参数 2
- value
原始写法
access(formatted, "value")| report | formatting |
|---|---|
report | formatting |
函数调用The executable view plan with native analysis evidence
table.merge- a
`会话`- b
`evidence`
原始写法
table.merge(a=`会话`, b=`evidence`)Functions
Variables
-
cells list · 3
# 单元 内核 1 计算 分析 2 格式化 分析 3 复核 复核 # 单元 内核 1 计算 分析 2 格式化 分析 3 复核 复核 -
evidence map · 2
report Map(4) formatting Map(2) key value report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 formatting key value total CN¥950.00 average CN¥158.33 -
formatted map · 3
ok True value Map(2) error None key value ok True value key value total CN¥950.00 average CN¥158.33 error None -
formatting map · 2
total CN¥950.00 average CN¥158.33 key value total CN¥950.00 average CN¥158.33 -
initial list · 2
# 内核 名称 值 1 分析 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 2 复核 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 # 内核 名称 值 1 分析 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 2 复核 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 -
kernels list · 2
# 名称 语言 1 分析 node 2 复核 node # 名称 语言 1 分析 node 2 复核 node -
markup textocclusionocclusion
-
orders list · 6
# region amount 1 华东 120 2 华东 300 3 华南 90 4 华南 140 5 华北 220 6 西部 80 # region amount 1 华东 120 2 华东 300 3 华南 90 4 华南 140 5 华北 220 6 西部 80 -
report map · 4
regions List(4) total 950 count 6 average 158.3333333333 key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 -
title textNative analysis and an explicit Intl formatting boundaryNative analysis and an explicit Intl formatting boundary
-
会话 map · 5
kind foreign-session kernels List(2) cells List(3) values List(2) inputs None key value kind foreign-session kernels # 名称 语言 1 分析 node 2 复核 node cells # 单元 内核 1 计算 分析 2 格式化 分析 3 复核 复核 values # 内核 名称 值 1 分析 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 2 复核 report key value regions # region orders total mean z_span 1 华东 2 420 210 1 2 华北 1 220 220 0 3 华南 2 230 115 1 4 西部 1 80 80 0 total 950 count 6 average 158.3333333333 inputs None -
复核 code · node```node var reviewMoney = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"}); console.log(JSON.stringify({count:report.count, total:reviewMoney.format(report.total)})); ``````node var reviewMoney = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"}); console.log(JSON.stringify({count:report.count, total:reviewMoney.format(report.total)})); ```
-
格式化 code · node```node console.log(money.format(report.total)); console.log(money.format(report.average)); ``````node console.log(money.format(report.total)); console.log(money.format(report.average)); ```
-
计算 code · node```node var money = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"}); console.log(JSON.stringify(report)); ``````node var money = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"}); console.log(JSON.stringify(report)); ```
可执行知识 · 输入、返回与依据
这份文档怎样成为可调用的知识
1 个知识单元 · 10 个结构步骤。先读输入、返回与调用边界,再按需查看依赖和依据。
以下来自静态分析,不代表程序已经运行、测试通过或内容已获领域确认。实际运行见正文标注与“运行与结果”。
main函数
需要什么输入
无需提供输入参数。
返回什么
map · View-session plan plus the native report and checked localized formatting
调用边界
启动进程、无已知宿主副作用。权限由实际运行入口授予;静态副作用信息不等于运行许可。
当前有哪些依据
- 语法与引用
- 检查通过;检查通过
- 契约检查
- 尚未检查
- 测试记录
- 没有可用记录
- 内容来源
- 尚无已核验证据
- 领域审阅
- 尚未进行领域审阅
查看本单元的结构步骤
这是源码结构,不是实际执行时序;正文引用不会因阅读而执行。
- 调用Perform all analysis in Marqdo
- 正文引用The executable view plan with native analysis evidence
- 调用Use the genuine external formatting boundary
- 调用Declare the view with native values and explicit kernels
- 观察Retain the checked persistent-kernel result
- 调用The executable view plan with native analysis evidence
- 正文引用Perform all analysis in Marqdo
- 正文引用Use the genuine external formatting boundary
- 正文引用Declare the view with native values and explicit kernels
- 正文引用Retain the checked persistent-kernel result
技术详情:身份、摘要与原始状态
- 目标标识
mq://public/features%2F19-foreign-view-cells/function/main- 制品摘要(未检查锁定状态)
sha256:3722f23101f6556a94af147a98fd6a5a691b11fb8df2c78398eef4ced0f6c055- 依赖标识
- 原始验证状态
parse: passed; resolve: passed; contract: unchecked; execution: not_run; tests: unknown; evidence: unverified; domain: unreviewed
运行与结果
完整源码
---
markup: occlusion
title: Native analysis and an explicit Intl formatting boundary
import:
foreign: lib/foreign.mq.md
table: lib/table.mq.md
result: lib/result.mq.md
native: ../../examples/foreign-native-report/index.mq.md
---
This page keeps order analysis in Marqdo and uses Node Intl only for locale-aware
currency formatting. Read [the actual native report tools](../../examples/foreign-native-report/index.mq.md)
for their independently callable input and return contracts. That single module
contains grouping, population statistics and the bounded persistent formatter.
Call this page's main with process.exec for a full workflow, or call analyze_orders
in that module with no effects for native analysis alone. View evaluates the same
cells with shared state and isolated kernels. No Python interpreter is needed.
## main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | View-session plan plus the native report and checked localized formatting |
This complete page uses six ordinary orders: their native total is 950, count
is six, and the four regional rows retain count, total, mean and normalized span.
The pure analysis is independently callable in the linked module. Formatting is a separate
capability with an explicit process.exec grant and an installed Node runtime.
The successful return contains report and formatting alongside the view-session
plan; it contains no live kernel handle and can be returned by marqdo call.
The view gets the same native report copied into two named kernels. Its cells
perform presentation rather than reimplementing native grouping or arithmetic.
Run All first initializes the formatter in the analysis kernel, then a second
cell reuses it. The review kernel receives its own report copy and formatter.
This demonstrates both shared state and kernel isolation. Running the dependent
formatting cell before its initializer should show the real missing-state error.
Static View export evaluates those same cells and embeds actual stdout.
Interactive View retains their kernels for later runs. The low-level formatter
used to check the public return is opened and closed separately, so it cannot
secretly supply state to the view kernels. No stdin, notebook command, generated
file-reader program or package installation is hidden in this example.
If Node or formatting fails, the page returns that failure before declaring a
ready view. Native-only consumers can still call analyze_orders with no effects.
The table cells below are data, while the three bound node fences are explicit
foreign code. The distinction is visible without translating a Python workflow
into another ad hoc command sequence.
`orders` =
| @ | region | amount |
|---|---|---|
| 1 | 华东 | 120 |
| 2 | 华东 | 300 |
| 3 | 华南 | 90 |
| 4 | 华南 | 140 |
| 5 | 华北 | 220 |
| 6 | 西部 | 80 |
We **report = [Perform all analysis in Marqdo](native.analyze_orders(orders=`orders`))** and **formatted = [Use the genuine external formatting boundary](native.format_summary(report=`report`))**.
1. not access(`formatted`, "ok")
Return *formatted* before declaring an executable view ready.
`kernels` =
| @ | 名称 | 语言 |
|---|---|---|
| 1 | 分析 | node |
| 2 | 复核 | node |
`cells` =
| @ | 单元 | 内核 |
|---|---|---|
| 1 | 计算 | 分析 |
| 2 | 格式化 | 分析 |
| 3 | 复核 | 复核 |
`initial` =
| @ | 内核 | 名称 | 值 |
|---|---|---|---|
| 1 | 分析 | report | `report` |
| 2 | 复核 | report | `report` |
We **会话 = [Declare the view with native values and explicit kernels](foreign.session(kernels=`kernels`, cells=`cells`, values=`initial`))**.
`计算` =
```node
var money = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"});
console.log(JSON.stringify(report));
```
`格式化` =
```node
console.log(money.format(report.total));
console.log(money.format(report.average));
```
`复核` =
```node
var reviewMoney = new Intl.NumberFormat("en-US", {style:"currency", currency:"CNY"});
console.log(JSON.stringify({count:report.count, total:reviewMoney.format(report.total)}));
```
We **formatting = [Retain the checked persistent-kernel result](access(formatted, "value"))**.
`evidence` =
| report | formatting |
|---|---|
| `report` | `formatting` |
Return *[The executable view plan with native analysis evidence](table.merge(a=`会话`, b=`evidence`))*.