Skip to content

Commit

Permalink
feat: Add threads join CI and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
meloalright committed Oct 8, 2024
1 parent 136a630 commit 2b5ea56
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Threading.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ jobs:
run: |
./target/release/3body -V
./target/release/3body -c '给 cx 以 程心(); 给 星环公司 以 法则(name, y, limit) { 给 掩体纪年 以 y; 面壁 (掩体纪年 <= limit) { 冬眠(1000); 广播([name, 掩体纪年]); 掩体纪年 = 掩体纪年 + 1; } } cx.thread(星环公司, ["掩体工程", 0, 11]) 冬眠(5000) cx.thread(星环公司, ["研制曲率飞船", 5, 11]) 冬眠(6000)'
./target/release/3body -c '给 cx 以 程心(); 给 星环公司 以 法则(name, y, limit) { 给 掩体纪年 以 y; 面壁 (掩体纪年 <= limit) { 冬眠(1000); 广播([name, 掩体纪年]); 掩体纪年 = 掩体纪年 + 1; } } 给 秘密研究 以 cx.thread(星环公司, ["重启光速飞船的研究", 11, 66]) cx.join(秘密研究)'
80 changes: 46 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,35 @@ $ 3body
// > true
```
##### Threading
```shell
程心(): Threading
```
## Summary
`example:`
|Token|3body-lang|Explanation|
|---|---|---|
|let||"give"|
|=||"as"|
|const|思想钢印|"thoughtcontrou"|
|+|前进|"go forward"|
|-|降维|"dimension reduction"|
|true|这是计划的一部分|"It's part of the plan."|
|false|主不在乎|"The Lord doesn't care."|
|fn|法则|"rule"|
|while|面壁|"face the wall"|
|break|破壁|"break the wall"|
|continue|延绪|"continue"|
|print|广播|"broadcast"|
|sleep|冬眠|"hibernation"|
|clear|二向箔清理|"two-way foil cleaning"|
|exit|毁灭|"destroy"|
|deep-equal|没关系的都一样|"It's okay. It's all the same."|
## 🧶 Threading
三体编程语言可以通过 "程心" 创建并管理线程。
Able to use threading to create and handle threads.
#### Threads Create
```rust
给 cx 以 程心();
Expand All @@ -220,43 +242,33 @@ cx.thread(星环公司, ["研制曲率飞船", 5, 11])
冬眠(6000)

// > ["掩体工程", 0]
// > ["掩体工程", 1]
// > ["掩体工程", 2]
// > ["掩体工程", 3]
// > ["掩体工程", 4]
// ...
// > ["研制曲率飞船", 5]
// > ["掩体工程", 5]
// > ["研制曲率飞船", 6]
// > ["掩体工程", 6]
// > ["研制曲率飞船", 7]
// > ["掩体工程", 7]
// > ["研制曲率飞船", 8]
// > ["掩体工程", 8]
// > ["研制曲率飞船", 9]
// > ["掩体工程", 9]
```
#### Threads Await
## Summary
```rust
给 cx 以 程心();

|Token|3body-lang|Explanation|
|---|---|---|
|let||"give"|
|=||"as"|
|const|思想钢印|"thoughtcontrou"|
|+|前进|"go forward"|
|-|降维|"dimension reduction"|
|true|这是计划的一部分|"It's part of the plan."|
|false|主不在乎|"The Lord doesn't care."|
|fn|法则|"rule"|
|while|面壁|"face the wall"|
|break|破壁|"break the wall"|
|continue|延绪|"continue"|
|print|广播|"broadcast"|
|sleep|冬眠|"hibernation"|
|clear|二向箔清理|"two-way foil cleaning"|
|exit|毁灭|"destroy"|
|deep-equal|没关系的都一样|"It's okay. It's all the same."|
给 星环公司 以 法则(name, y, limit) {
给 掩体纪年 以 y;
面壁 (掩体纪年 <= limit) {
冬眠(1000);
广播([name, 掩体纪年]);
掩体纪年 = 掩体纪年 + 1;
}
}

给 秘密研究 以 cx.thread(星环公司, ["重启光速飞船的研究", 11, 66])
cx.join(秘密研究)

// > ["重启光速飞船的研究", 11]
// > ["重启光速飞船的研究", 12]
```
## 🤗 LLM
Expand Down

0 comments on commit 2b5ea56

Please sign in to comment.