Skip to content

Commit 92441e2

Browse files
committed
chore: sync faq documents between the latest doc and v0.8 doc
Signed-off-by: peefy <[email protected]>
1 parent 410abf3 commit 92441e2

File tree

8 files changed

+97
-20
lines changed

8 files changed

+97
-20
lines changed

docs/user_docs/support/faq-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't want to perform these steps every time you open an application, you
1515
Open the terminal and run the following command:
1616

1717
```shell
18-
xattr -rd com.apple.quarantine /path/to/kcl
18+
xattr -d com.apple.quarantine /path/to/kcl
1919
```
2020

2121
Where `/path/to/kcl` is the complete path of the kcl application. After running the command, the application will be added to the whitelist and Gatekeeper will no longer prevent it from running.

docs/user_docs/support/faq-kcl.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ alice: Person = config
24992499
25002500
In KCL, we can use `${..}` for string interpolation. But in some cases, we don't want to escape it. Therefore, we use create a raw string by prefixing the string literal with `'r'` or `'R'`. An example KCL code over here is:
25012501

2502-
```KCL
2502+
```python
25032503
worldString = "world"
25042504
s = "Hello ${worldString}"
25052505
raw_s = r"Hello ${worldString}"
@@ -2517,7 +2517,7 @@ raw_s: Hello ${worldString}
25172517

25182518
For lambda(s),KCL automatically infers the return value type in the function body, although we can explicitly specify it. An example KCL code over here is:
25192519

2520-
```KCL
2520+
```python
25212521
f1 = lambda t: Type1 {
25222522
Type2 {}
25232523
} # The type of f1 is (Type1) -> Type2
@@ -2529,25 +2529,24 @@ f2 = lambda t: Type1 -> Type2 {
25292529

25302530
## 60. How to convert a list of lists to a single list in KCL?
25312531

2532-
To convert a list of lists into a single list, we use the `sum()` function. For example if we have a number of lists such as `[[1,2],[3,4]], [5,6]`, we use the KCL code given below to convert these three lists into a single list:
2532+
To convert a list of lists into a single list, we use the `sum()` function. For example if we have a number of lists such as `[[1,2],[3,4], [5,6]]`, we use the KCL code given below to convert these three lists into a single list:
25332533

2534-
```KCL
2535-
final_list = sum([[1,2],[3,4]],[5,6])
2534+
```python
2535+
final_list = sum([[1,2],[3,4],[5,6]], [])
25362536
```
25372537

25382538
The above KCL code gives the output:
25392539

25402540
```yaml
25412541
final_list:
2542-
- 5
2543-
- 6
25442542
- 1
25452543
- 2
25462544
- 3
25472545
- 4
2546+
- 5
2547+
- 6
25482548
```
25492549

25502550
## 61. What does `version: "v1" = "v1"` mean?
25512551

2552-
The first `"v1"` over here denotes that the type of version is of string literal type. The second `"v1"` denotes that the default value of version is `"v1"`.
2553-
2552+
The first `"v1"` over here denotes that the type of the variable `version` is of string literal type. The second `"v1"` denotes that the default value of the variable `version` is `"v1"`.

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/support/faq-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MacOS 提示无法打开 "kcl",因为 Apple 无法检查其是否包含恶意
1515
打开终端并输入以下命令:
1616

1717
```shell
18-
xattr -rd com.apple.quarantine /path/to/kcl
18+
xattr -d com.apple.quarantine /path/to/kcl
1919
```
2020

2121
其中,/path/to/kcl 是 kcl 应用程序的完整路径。运行命令后,应用程序将被添加到白名单中,Gatekeeper 将不再阻止其运行。

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/support/faq-kcl.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,3 +2519,40 @@ worldString: world
25192519
s: Hello world
25202520
raw_s: Hello ${worldString}
25212521
```
2522+
2523+
## 59. 在 KCL 中如何推断 lambda 函数的返回值类型?
2524+
2525+
对于 Lambda 函数,KCL 可以自动推断函数体中的返回值类型,尽管我们也可以明确指定它。下面是一个 KCL 代码示例:
2526+
2527+
```python
2528+
f1 = lambda t: Type1 {
2529+
Type2 {}
2530+
} # f1 的类型是 (Type1) -> Type2
2531+
f2 = lambda t: Type1 -> Type2 {
2532+
Type2 {}
2533+
} # f2 的类型是 (Type1) -> Type2, 在这个例子中,我们显式指定了返回值类型为 Type2
2534+
```
2535+
2536+
## 60. 在 KCL 中如何将列表的列表转换为单个列表?
2537+
2538+
要将列表的列表转换为单个列表,我们可以使用 sum() 函数。例如,如果我们有多个列表,比如 `[[1,2],[3,4],[5,6]]`,我们可以使用以下 KCL 代码将这三个列表转换为单个列表:
2539+
2540+
```python
2541+
final_list = sum([[1,2],[3,4],[5,6]], [])
2542+
```
2543+
2544+
上述 KCL 代码的输出如下:
2545+
2546+
```yaml
2547+
final_list:
2548+
- 1
2549+
- 2
2550+
- 3
2551+
- 4
2552+
- 5
2553+
- 6
2554+
```
2555+
2556+
## 61. KCL 代码片段 `version: "v1" = "v1"` 是什么意思?
2557+
2558+
这里的第一个 `"v1"` 表示变量 `version` 的类型是字符串字面类型。第二个 `"v1"` 表示变量 `version` 的默认值是 "v1"。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/support/faq-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MacOS 提示无法打开 "kcl",因为 Apple 无法检查其是否包含恶意
1515
打开终端并输入以下命令:
1616

1717
```shell
18-
xattr -rd com.apple.quarantine /path/to/kcl
18+
xattr -d com.apple.quarantine /path/to/kcl
1919
```
2020

2121
其中,/path/to/kcl 是 kcl 应用程序的完整路径。运行命令后,应用程序将被添加到白名单中,Gatekeeper 将不再阻止其运行。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/support/faq-kcl.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,3 +2519,40 @@ worldString: world
25192519
s: Hello world
25202520
raw_s: Hello ${worldString}
25212521
```
2522+
2523+
## 59. 在 KCL 中如何推断 lambda 函数的返回值类型?
2524+
2525+
对于 Lambda 函数,KCL 可以自动推断函数体中的返回值类型,尽管我们也可以明确指定它。下面是一个 KCL 代码示例:
2526+
2527+
```python
2528+
f1 = lambda t: Type1 {
2529+
Type2 {}
2530+
} # f1 的类型是 (Type1) -> Type2
2531+
f2 = lambda t: Type1 -> Type2 {
2532+
Type2 {}
2533+
} # f2 的类型是 (Type1) -> Type2, 在这个例子中,我们显式指定了返回值类型为 Type2
2534+
```
2535+
2536+
## 60. 在 KCL 中如何将列表的列表转换为单个列表?
2537+
2538+
要将列表的列表转换为单个列表,我们可以使用 sum() 函数。例如,如果我们有多个列表,比如 `[[1,2],[3,4],[5,6]]`,我们可以使用以下 KCL 代码将这三个列表转换为单个列表:
2539+
2540+
```python
2541+
final_list = sum([[1,2],[3,4],[5,6]], [])
2542+
```
2543+
2544+
上述 KCL 代码的输出如下:
2545+
2546+
```yaml
2547+
final_list:
2548+
- 1
2549+
- 2
2550+
- 3
2551+
- 4
2552+
- 5
2553+
- 6
2554+
```
2555+
2556+
## 61. KCL 代码片段 `version: "v1" = "v1"` 是什么意思?
2557+
2558+
这里的第一个 `"v1"` 表示变量 `version` 的类型是字符串字面类型。第二个 `"v1"` 表示变量 `version` 的默认值是 "v1"。

versioned_docs/version-0.8/user_docs/support/faq-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't want to perform these steps every time you open an application, you
1515
Open the terminal and run the following command:
1616

1717
```shell
18-
xattr -rd com.apple.quarantine /path/to/kcl
18+
xattr -d com.apple.quarantine /path/to/kcl
1919
```
2020

2121
Where `/path/to/kcl` is the complete path of the kcl application. After running the command, the application will be added to the whitelist and Gatekeeper will no longer prevent it from running.

versioned_docs/version-0.8/user_docs/support/faq-kcl.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ alice: Person = config
24992499
25002500
In KCL, we can use `${..}` for string interpolation. But in some cases, we don't want to escape it. Therefore, we use create a raw string by prefixing the string literal with `'r'` or `'R'`. An example KCL code over here is:
25012501

2502-
```KCL
2502+
```python
25032503
worldString = "world"
25042504
s = "Hello ${worldString}"
25052505
raw_s = r"Hello ${worldString}"
@@ -2517,7 +2517,7 @@ raw_s: Hello ${worldString}
25172517

25182518
For lambda(s),KCL automatically infers the return value type in the function body, although we can explicitly specify it. An example KCL code over here is:
25192519

2520-
```KCL
2520+
```python
25212521
f1 = lambda t: Type1 {
25222522
Type2 {}
25232523
} # The type of f1 is (Type1) -> Type2
@@ -2529,20 +2529,24 @@ f2 = lambda t: Type1 -> Type2 {
25292529

25302530
## 60. How to convert a list of lists to a single list in KCL?
25312531

2532-
To convert a list of lists into a single list, we use the `sum()` function. For example if we have a number of lists such as `[[1,2],[3,4]], [5,6]`, we use the KCL code given below to convert these three lists into a single list:
2532+
To convert a list of lists into a single list, we use the `sum()` function. For example if we have a number of lists such as `[[1,2],[3,4], [5,6]]`, we use the KCL code given below to convert these three lists into a single list:
25332533

2534-
```KCL
2535-
final_list = sum([[1,2],[3,4]],[5,6])
2534+
```python
2535+
final_list = sum([[1,2],[3,4],[5,6]], [])
25362536
```
25372537

25382538
The above KCL code gives the output:
25392539

25402540
```yaml
25412541
final_list:
2542-
- 5
2543-
- 6
25442542
- 1
25452543
- 2
25462544
- 3
25472545
- 4
2546+
- 5
2547+
- 6
25482548
```
2549+
2550+
## 61. What does `version: "v1" = "v1"` mean?
2551+
2552+
The first `"v1"` over here denotes that the type of the variable `version` is of string literal type. The second `"v1"` denotes that the default value of the variable `version` is `"v1"`.

0 commit comments

Comments
 (0)