deploy: ffe06d7afa
This commit is contained in:
commit
a4c04666b4
217 files changed
+506293
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Booleans and logic
|
||||
description: True / False / None and and / or / not
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Keywords: `True`, `False`, `None`, and `and` / `or` / `not`.
|
||||
|
||||
We first **a = True** for the next step.
|
||||
We first **b = False** for the next step.
|
||||
|
||||
1. `a` and not `b`
|
||||
We now **[Display this step's result](> print text="ok")**.
|
||||
2. *
|
||||
We now **[Display this step's result](> print text="fail")**.
|
||||
|
||||
We first **probe = 1** for the next step.
|
||||
|
||||
1. None
|
||||
We now **[Display this step's result](> print text="none-truthy")**.
|
||||
2. *
|
||||
We now **[Display this step's result](> print text="none-falsy")**.
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Built-in input
|
||||
description: Read one line from stdin; optional prompt. Demo via frontmatter stdin.
|
||||
stdin: Ada
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
The input builtin reads one line. For demos and marqdo view / static export, put sample lines in frontmatter (stdin:). CLI can also use a pipe or --stdin-file. Live view can override with the Preset input box.
|
||||
|
||||
We first **name = [Compute name](input(prompt="Name: "))** for the next step.
|
||||
|
||||
We now **[Display this step's result](> print text="Hello `name`!")**.
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Built-in print
|
||||
description: Named and positional forms
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
The `print` builtin accepts named or positional arguments:
|
||||
|
||||
We now **[Display this step's result](> print text="named form")**.
|
||||
|
||||
We now **[Display this step's result](> print "positional")**.
|
||||
|
||||
Named args may contain spaces; positional args may not.
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Built-ins len / str / int / type / trim / split / join / at
|
||||
description: Host builtins for strings and tables
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
|
||||
|
||||
Length and type:
|
||||
|
||||
We first **s = "hello"** for the next step.
|
||||
|
||||
We first **n = [Compute n](len(`s`))** for the next step.
|
||||
|
||||
We now **[Display this step's result](> print text=`n`)**.
|
||||
|
||||
We first **ty = [Compute ty](type(`s`))** for the next step.
|
||||
|
||||
We now **[Display this step's result](> print text=`ty`)**.
|
||||
|
||||
Trim, split, join, and index:
|
||||
|
||||
We first **t = [Compute t](trim(value=" hi "))** for the next step.
|
||||
|
||||
We first **parts = [Compute parts](split(value="a,b", sep=","))** for the next step.
|
||||
|
||||
We first **mid = [Compute mid](at(value=`parts`, index=0))** for the next step.
|
||||
|
||||
We first **j = [Compute j](join(value=`parts`, sep="-"))** for the next step.
|
||||
|
||||
We now **[Display this step's result](> print text=`t`)**.
|
||||
|
||||
We now **[Display this step's result](> print text=`mid`)**.
|
||||
|
||||
We now **[Display this step's result](> print text=`j`)**.
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 中英内核双名
|
||||
description: 无需导入:打印、长度、文本、整数 与 print / len / …
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
内核中英别名等价,可混用:
|
||||
|
||||
我们先**s = "你好"**,供下一步使用。
|
||||
|
||||
我们先**n = [计算并保存 n](长度(值=`s`))**,供下一步使用。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`n`)**。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> print text="also-english")**。
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 布尔与逻辑
|
||||
description: 真 / 假 / 空 与 且 / 或 / 非
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
关键字:`真`、`假`、`空`,以及 `且` / `或` / `非`。
|
||||
|
||||
我们先**a = True**,供下一步使用。
|
||||
我们先**b = False**,供下一步使用。
|
||||
|
||||
1. `a` 且 非 `b`
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="通过")**。
|
||||
2. *
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="失败")**。
|
||||
|
||||
我们先**probe = 1**,供下一步使用。
|
||||
|
||||
1. 空
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="空为真")**。
|
||||
2. *
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="空为假")**。
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 内置 打印
|
||||
description: 具名与位置两种写法
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
内置 `打印` 接受具名或位置实参:
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="具名写法")**。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 "位置写法")**。
|
||||
|
||||
具名实参可以带空格;位置实参不可以。
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 内置 长度 / 文本 / 整数 与 trim 等
|
||||
description: 主机内置;中文别名覆盖常用几个
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
长度与英文 `type`(类型无中文内核别名,见标准库文档):
|
||||
|
||||
我们先**s = "你好"**,供下一步使用。
|
||||
|
||||
我们先**n = [计算并保存 n](长度(值=`s`))**,供下一步使用。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`n`)**。
|
||||
|
||||
我们先**ty = [计算并保存 ty](type(`s`))**,供下一步使用。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`ty`)**。
|
||||
|
||||
去空白、拆分、拼接、按下标(主机名仍为英文):
|
||||
|
||||
我们先**t = [计算并保存 t](trim(value=" 嗨 "))**,供下一步使用。
|
||||
|
||||
我们先**parts = [计算并保存 parts](split(value="甲,乙", sep=","))**,供下一步使用。
|
||||
|
||||
我们先**mid = [计算并保存 mid](at(value=`parts`, index=0))**,供下一步使用。
|
||||
|
||||
我们先**j = [计算并保存 j](join(value=`parts`, sep="-"))**,供下一步使用。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`t`)**。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`mid`)**。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容=`j`)**。
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 内置 输入
|
||||
description: 从 stdin 读一行;可选提示。演示数据写在 frontmatter 输入。
|
||||
输入: 小明
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
|
||||
|
||||
内置「输入」读一行。演示与 marqdo view / 静态导出可在 frontmatter 写「输入:」(或 stdin:)。CLI 也可用管道或 --stdin-file。Live view 可用 Preset input 覆盖。
|
||||
|
||||
我们先**名字 = [计算并保存 名字](输入(提示="名字:"))**,供下一步使用。
|
||||
|
||||
随后我们**[显示当前步骤的结果](> 打印 内容="你好 `名字`!")**。
|
||||
Reference in new issue
Block a user