Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
@@ -6,8 +6,12 @@ description: Smallest runnable doc
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Ordinary paragraphs are comments. `print` is a built-in, not a syntax marker.
|
||||
|
||||
Lines that start with Markdown emphasis markers can be treated as code — keep narrative as plain prose.
|
||||
|
||||
> print text=Hello World!
|
||||
We now **[Display this step's result](> print text="Hello World!")**.
|
||||
@@ -6,8 +6,12 @@ description: 最小可运行文档
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
普通段落是注释。`打印` 是内置函数,不是语法标记。
|
||||
|
||||
以 Markdown 强调标记开头的行可当作代码——叙述请用普通段落。
|
||||
|
||||
> 打印 内容=你好世界!
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="你好世界!")**。
|
||||
@@ -1,18 +1,30 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Functions and named calls
|
||||
description: `#` defines functions; `>` calls; `-` lists parameter names
|
||||
description: Callable headings, narrative inputs and readable named calls
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
Use `#` / `##` for functions. Parameters are bare `- name` lines under the heading.
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Headings expose callable definitions. The input contract sits directly below the heading, and its body names the recipient in prose; callers supply that value by name.
|
||||
|
||||
Call with `>` and named args `param=value`:
|
||||
|
||||
> greet who=World
|
||||
We now **[Call greet](> greet who="World")**.
|
||||
|
||||
## greet
|
||||
+ `who`
|
||||
|
||||
> print text=Hello `who`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| who | any | required | Recipient name inserted into the greeting |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; display the computed content on stdout |
|
||||
Input `who`, used by the steps below.
|
||||
|
||||
We now **[Display this step's result](> print text="Hello `who`!")**.
|
||||
@@ -6,13 +6,25 @@ description: `#` 定义函数;`>` 调用;`-` 列出参数名
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
用 `#` / `##` 定义函数。参数是标题下的裸 `- 名` 行。
|
||||
|
||||
用 `>` 与具名实参 `参数=值` 调用:
|
||||
|
||||
> 问候 谁=世界
|
||||
随后我们**[执行 问候](> 问候 谁="世界")**。
|
||||
|
||||
## 问候
|
||||
+ `谁`
|
||||
|
||||
> 打印 内容=你好 `谁`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 谁 | any | 必填 | 要显示在问候中的称呼 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;通过标准输出显示本函数计算的内容。 |
|
||||
输入`谁`,按下方步骤使用这个值。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="你好 `谁`!")**。
|
||||
@@ -6,15 +6,27 @@ description: Bind by parameter order; named form still works
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Positional args bind in declaration order (no `who=` needed):
|
||||
|
||||
> greet Marqdo
|
||||
We now **[Call greet](> greet "Marqdo")**.
|
||||
|
||||
Named form still works:
|
||||
|
||||
> greet who=World
|
||||
We now **[Call greet](> greet who="World")**.
|
||||
|
||||
## greet
|
||||
+ `who`
|
||||
|
||||
> print text=Hello `who`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| who | any | required | Recipient name inserted into the greeting |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; display the computed content on stdout |
|
||||
Input `who`, used by the steps below.
|
||||
|
||||
We now **[Display this step's result](> print text="Hello `who`!")**.
|
||||
@@ -6,15 +6,27 @@ description: 按参数声明顺序绑定;具名写法仍然可用
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
位置实参按声明顺序绑定(不必写 `谁=`):
|
||||
|
||||
> 问候 Marqdo
|
||||
随后我们**[执行 问候](> 问候 "Marqdo")**。
|
||||
|
||||
具名写法仍然可用:
|
||||
|
||||
> 问候 谁=世界
|
||||
随后我们**[执行 问候](> 问候 谁="世界")**。
|
||||
|
||||
## 问候
|
||||
+ `谁`
|
||||
|
||||
> 打印 内容=你好 `谁`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 谁 | any | 必填 | 要显示在问候中的称呼 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;通过标准输出显示本函数计算的内容。 |
|
||||
输入`谁`,按下方步骤使用这个值。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="你好 `谁`!")**。
|
||||
@@ -1,18 +1,22 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Branch
|
||||
description: `+` arms; a lone `*` arm is else
|
||||
description: Ordered branches select one case and retain an explicit fallback
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
Italic lines are statements. Branches use `+`; a head that is only `*` is the else arm.
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
**`x` = 0**
|
||||
Bold markers execute statements and single italics return a value. Ordered list items select a branch; the final asterisk condition is the fallback when earlier conditions do not match.
|
||||
|
||||
We first **x = 0** for the next step.
|
||||
|
||||
1. `x` > 0
|
||||
> print text=positive
|
||||
We now **[Display this step's result](> print text="positive")**.
|
||||
2. `x` < 0
|
||||
> print text=negative
|
||||
We now **[Display this step's result](> print text="negative")**.
|
||||
3. *
|
||||
> print text=zero
|
||||
We now **[Display this step's result](> print text="zero")**.
|
||||
@@ -6,13 +6,17 @@ description: `+` 各臂;单独的 `*` 臂为否则
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
斜体行是语句。分支用 `+`;表头仅为 `*` 的是否则臂。
|
||||
|
||||
**`x` = 0**
|
||||
我们先**x = 0**,供下一步使用。
|
||||
|
||||
1. `x` > 0
|
||||
> 打印 内容=正数
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="正数")**。
|
||||
2. `x` < 0
|
||||
> 打印 内容=负数
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="负数")**。
|
||||
3. *
|
||||
> 打印 内容=零
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="零")**。
|
||||
@@ -6,15 +6,19 @@ description: Condition loops and table walks
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Inside a function body, `-` starts a loop (not a parameter).
|
||||
|
||||
Countdown:
|
||||
|
||||
**`n` = 3**
|
||||
We first **n = 3** for the next step.
|
||||
|
||||
- `n` > 0
|
||||
> print text=`n`
|
||||
**`n` = `n` - 1**
|
||||
We now **[Display this step's result](> print text=`n`)**.
|
||||
We first **n = (`n` - 1)** for the next step.
|
||||
|
||||
Walk a table (tables are collections):
|
||||
|
||||
@@ -26,4 +30,4 @@ Walk a table (tables are collections):
|
||||
| pear |
|
||||
|
||||
- [fruit](遍历 basket 为 fruit)
|
||||
> print text=today `fruit`
|
||||
We now **[Display this step's result](> print text="today `fruit`")**.
|
||||
@@ -6,15 +6,19 @@ description: 条件循环与表遍历
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
在函数体里,`-` 表示循环(不是参数)。
|
||||
|
||||
倒数:
|
||||
|
||||
**`n` = 3**
|
||||
我们先**n = 3**,供下一步使用。
|
||||
|
||||
- `n` > 0
|
||||
> 打印 内容=`n`
|
||||
**`n` = `n` - 1**
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`n`)**。
|
||||
我们先**n = (`n` - 1)**,供下一步使用。
|
||||
|
||||
遍历表(表即集合):
|
||||
|
||||
@@ -26,4 +30,4 @@ description: 条件循环与表遍历
|
||||
| 梨 |
|
||||
|
||||
- [水果](遍历 篮子 为 水果)
|
||||
> 打印 内容=今天 `水果`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="今天 `水果`")**。
|
||||
@@ -6,6 +6,10 @@ description: One-column tables are lists
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
A single-column Markdown table is a list; loop to read each item. Prefer link-index get `[1](basket)` (1-based).
|
||||
|
||||
`basket` =
|
||||
@@ -17,4 +21,4 @@ A single-column Markdown table is a list; loop to read each item. Prefer link-in
|
||||
| peach |
|
||||
|
||||
- [fruit](遍历 basket 为 fruit)
|
||||
> print text=`fruit`
|
||||
We now **[Display this step's result](> print text=`fruit`)**.
|
||||
@@ -6,6 +6,10 @@ description: 单列竖表即列表
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
单列 Markdown 表是列表;用循环读每一项。按下标优先用链接取元 `[1](篮子)`(1-based)。
|
||||
|
||||
`篮子` =
|
||||
@@ -17,4 +21,4 @@ description: 单列竖表即列表
|
||||
| 桃 |
|
||||
|
||||
- [水果](遍历 篮子 为 水果)
|
||||
> 打印 内容=`水果`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`水果`)**。
|
||||
@@ -6,6 +6,10 @@ description: Multi-column tables are maps; link-index get
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
A multi-column table with one data row is a map. Read values with `[key](map)`.
|
||||
|
||||
`kinds` =
|
||||
@@ -14,10 +18,10 @@ A multi-column table with one data row is a map. Read values with `[key](map)`.
|
||||
|-------|----------|
|
||||
| fruit | vegetable |
|
||||
|
||||
**`k` = [apple](access(kinds, "apple"))**
|
||||
We first **k = [apple](access(`kinds`, "apple"))** for the next step.
|
||||
|
||||
> print text=`k`
|
||||
We now **[Display this step's result](> print text=`k`)**.
|
||||
|
||||
**`k` = [cucumber](access(kinds, "cucumber"))**
|
||||
We first **k = [cucumber](access(`kinds`, "cucumber"))** for the next step.
|
||||
|
||||
> print text=`k`
|
||||
We now **[Display this step's result](> print text=`k`)**.
|
||||
@@ -6,6 +6,10 @@ description: 多列表是字典;链接取元
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
多列且仅一行数据的表是字典。用 `[键](字典)` 取元。
|
||||
|
||||
`分类` =
|
||||
@@ -14,10 +18,10 @@ description: 多列表是字典;链接取元
|
||||
|------|------|
|
||||
| 水果 | 蔬菜 |
|
||||
|
||||
**`种` = [苹果](access(分类, "苹果"))**
|
||||
我们先**种 = [苹果](access(`分类`, "苹果"))**,供下一步使用。
|
||||
|
||||
> 打印 内容=`种`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`种`)**。
|
||||
|
||||
**`种` = [黄瓜](access(分类, "黄瓜"))**
|
||||
我们先**种 = [黄瓜](access(`分类`, "黄瓜"))**,供下一步使用。
|
||||
|
||||
> 打印 内容=`种`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`种`)**。
|
||||
@@ -6,6 +6,10 @@ description: First header @ / row makes a list of maps
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
When the first header is `@` or `row`, each data row is a map (marker column is not a field). Nested get: `[field]([1](orders))`.
|
||||
|
||||
`orders` =
|
||||
@@ -15,10 +19,10 @@ When the first header is `@` or `row`, each data row is a map (marker column is
|
||||
| 1 | apple | 2 |
|
||||
| 2 | pear | 3 |
|
||||
|
||||
**`n` = [name](access([1](access(orders, "1")), "name"))**
|
||||
We first **n = [name](access([1](access(`orders`, "1")), "name"))** for the next step.
|
||||
|
||||
> print text=`n`
|
||||
We now **[Display this step's result](> print text=`n`)**.
|
||||
|
||||
**`q` = [qty](access([2](access(orders, "2")), "qty"))**
|
||||
We first **q = [qty](access([2](access(`orders`, "2")), "qty"))** for the next step.
|
||||
|
||||
> print text=`q`
|
||||
We now **[Display this step's result](> print text=`q`)**.
|
||||
@@ -6,6 +6,14 @@ description: 首列表头「行」→ 每行一个字典
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
表头标记决定了这是一组行记录,而不是按列保存的字段列表。第一条记录的品名为苹果,第二条记录的数量为三;标记列只负责声明形态,不成为业务字段。读者可以先用 access 选出某一条记录,再按字段名取值,逐步核对每一步得到的是列表、记录还是标量。
|
||||
|
||||
本例保留两种字段类型:品名是文本,数量是整数,不把整张表先转成 JSON 再解析。遮蔽标签只写读取目的,真正的索引和字段名放在圆括号里;不要把标签中的数字当成另外一次索引。所有数据都来自本页,没有文件或网络访问。扩展字段时应同步更新相关函数的输入契约,让调用者知道新增列是否必填。
|
||||
|
||||
首列表头为 `行`(或 `@` / `row`)时,每行数据是一个字典;标记列不进入字段。嵌套取元:`[字段]([1](订单))`。
|
||||
|
||||
`订单` =
|
||||
@@ -15,10 +23,10 @@ description: 首列表头「行」→ 每行一个字典
|
||||
| 1 | 苹果 | 2 |
|
||||
| 2 | 梨 | 3 |
|
||||
|
||||
**`名` = [品名](access([1](access(订单, "1")), "品名"))**
|
||||
我们先**名 = [品名](access([1](access(`订单`, "1")), "品名"))**,供下一步使用。
|
||||
|
||||
> 打印 内容=`名`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`名`)**。
|
||||
|
||||
**`量` = [数量](access([2](access(订单, "2")), "数量"))**
|
||||
我们先**量 = [数量](access([2](access(`订单`, "2")), "数量"))**,供下一步使用。
|
||||
|
||||
> 打印 内容=`量`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`量`)**。
|
||||
@@ -6,25 +6,53 @@ description: "# Child = > Parent; methods walk the base chain"
|
||||
|
||||
# Greeter
|
||||
|
||||
## hello
|
||||
+ `who`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | Object/type namespace for the child functions below; call the intended child directly |
|
||||
|
||||
**`msg` = "Hello, `who`!"**
|
||||
*`msg`*
|
||||
## hello
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| who | any | required | Recipient name inserted into the greeting |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
|
||||
Input `who`, used by the steps below.
|
||||
|
||||
We first **msg = "Hello, `who`!"** for the next step.
|
||||
After these steps, return *msg*.
|
||||
|
||||
# Loud = > Greeter
|
||||
|
||||
## hello
|
||||
+ `who`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | Object/type namespace for the child functions below; call the intended child directly |
|
||||
|
||||
**`msg` = "HELLO, `who`!"**
|
||||
*`msg`*
|
||||
## hello
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| who | any | required | Recipient name inserted into the greeting |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
|
||||
Input `who`, used by the steps below.
|
||||
|
||||
We first **msg = "HELLO, `who`!"** for the next step.
|
||||
After these steps, return *msg*.
|
||||
|
||||
# main
|
||||
|
||||
**`g` = > Greeter**
|
||||
**`m` = > `g`.hello who="world"**
|
||||
> print text=`m`
|
||||
**`l` = > Loud**
|
||||
**`m2` = > `l`.hello who="world"**
|
||||
> print text=`m2`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
We first **g = [Compute g](Greeter())** for the next step.
|
||||
We first **m = `g`.hello(who="world")** for the next step.
|
||||
We now **[Display this step's result](> print text=`m`)**.
|
||||
We first **l = [Compute l](Loud())** for the next step.
|
||||
We first **m2 = `l`.hello(who="world")** for the next step.
|
||||
We now **[Display this step's result](> print text=`m2`)**.
|
||||
@@ -6,25 +6,53 @@ description: "# 子类 = > 父类;方法沿基类链查找"
|
||||
|
||||
# 问候者
|
||||
|
||||
## 你好
|
||||
+ `谁`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 供下述方法复用的对象或类型命名空间;直接调用所需的子函数。 |
|
||||
|
||||
**`msg` = "你好,`谁`!"**
|
||||
*`msg`*
|
||||
## 你好
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 谁 | any | 必填 | 要显示在问候中的称呼 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
|
||||
输入`谁`,按下方步骤使用这个值。
|
||||
|
||||
我们先**msg = "你好,`谁`!"**,供下一步使用。
|
||||
完成上述步骤后,返回*msg*。
|
||||
|
||||
# 大声 = > 问候者
|
||||
|
||||
## 你好
|
||||
+ `谁`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 供下述方法复用的对象或类型命名空间;直接调用所需的子函数。 |
|
||||
|
||||
**`msg` = "你好,`谁`!!!"**
|
||||
*`msg`*
|
||||
## 你好
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 谁 | any | 必填 | 要显示在问候中的称呼 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
|
||||
输入`谁`,按下方步骤使用这个值。
|
||||
|
||||
我们先**msg = "你好,`谁`!!!"**,供下一步使用。
|
||||
完成上述步骤后,返回*msg*。
|
||||
|
||||
# main
|
||||
|
||||
**`g` = > 问候者**
|
||||
**`m` = > `g`.你好 谁="世界"**
|
||||
> 打印 内容=`m`
|
||||
**`l` = > 大声**
|
||||
**`m2` = > `l`.你好 谁="世界"**
|
||||
> 打印 内容=`m2`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
我们先**g = [计算并保存 g](问候者())**,供下一步使用。
|
||||
我们先**m = `g`.你好(谁="世界")**,供下一步使用。
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`m`)**。
|
||||
我们先**l = [计算并保存 l](大声())**,供下一步使用。
|
||||
我们先**m2 = `l`.你好(谁="世界")**,供下一步使用。
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`m2`)**。
|
||||
@@ -8,12 +8,16 @@ import:
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
In the YAML header, nested `import:` with `utils: utils.mq.md` imports a sibling module and binds the library name `utils`.
|
||||
|
||||
Bind a return value, print it, then call greet:
|
||||
|
||||
**`y` = [utils.add_one] n=41**
|
||||
We first **y = [Compute y](utils.add_one(n=41))** for the next step.
|
||||
|
||||
> print text=`y`
|
||||
We now **[Display this step's result](> print text=`y`)**.
|
||||
|
||||
> utils.greet who=Marqdo
|
||||
We now **[Call utils.greet](> utils.greet who="Marqdo")**.
|
||||
@@ -5,13 +5,29 @@ description: Imported by main; italic is return; print for side effects
|
||||
---
|
||||
|
||||
## add_one
|
||||
+ `n`
|
||||
|
||||
*n + 1*
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| n | any | required | Numeric input advanced or calculated by this example |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
|
||||
Input `n`, used by the steps below.
|
||||
|
||||
After these steps, return *(`n` + 1)*.
|
||||
|
||||
## greet
|
||||
+ `who`
|
||||
|
||||
> print text=Hello, `who`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| who | any | required | Recipient name inserted into the greeting |
|
||||
|
||||
*None*
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; this function performs the described effects instead of returning business data |
|
||||
Input `who`, used by the steps below.
|
||||
|
||||
We now **[Display this step's result](> print text="Hello, `who`!")**.
|
||||
|
||||
After these steps, return *None*.
|
||||
@@ -8,12 +8,16 @@ description: frontmatter 导入 bind:路径.mq.md
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
在 YAML 头里写 `导入 工具:工具.mq.md` 可导入同级模块并绑定库名「工具」。
|
||||
|
||||
绑定返回值、打印,再调用问候:
|
||||
|
||||
**`y` = [工具.加一] n=41**
|
||||
我们先**y = [计算并保存 y](工具.加一(n=41))**,供下一步使用。
|
||||
|
||||
> 打印 内容=`y`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`y`)**。
|
||||
|
||||
> 工具.问候 谁=Marqdo
|
||||
随后我们**[执行 工具.问候](> 工具.问候 谁="Marqdo")**。
|
||||
@@ -5,13 +5,29 @@ description: 被 main 导入;斜体为返回;副作用用打印
|
||||
---
|
||||
|
||||
## 加一
|
||||
+ `n`
|
||||
|
||||
*n + 1*
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| n | any | 必填 | Numeric input advanced or calculated by this example |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
|
||||
输入`n`,按下方步骤使用这个值。
|
||||
|
||||
完成上述步骤后,返回*(`n` + 1)*。
|
||||
|
||||
## 问候
|
||||
+ `谁`
|
||||
|
||||
> 打印 内容=你好,`谁`!
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 谁 | any | 必填 | 要显示在问候中的称呼 |
|
||||
|
||||
*无*
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;本函数通过上述操作产生效果,不返回业务数据。 |
|
||||
输入`谁`,按下方步骤使用这个值。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="你好,`谁`!")**。
|
||||
|
||||
完成上述步骤后,返回*None*。
|
||||
Reference in new issue
Block a user