Skip to content

Commit 3d679eb

Browse files
authored
Merge pull request #378 from cuixiping/master
Add a summary for examples
2 parents 79e64a7 + 82c0472 commit 3d679eb

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

examples/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
# Examples(範例)
3+
4+
| File(文檔) | Remark(說明) |
5+
| -------------------------- | ----------------------- |
6+
| beer.wy | while |
7+
| collatz.wy | 角谷猜想 |
8+
| collatz2.wy | 考拉兹猜想(角谷猜想) |
9+
| divination.wy | 春秋古筮法 |
10+
| eightqueens.wy | 八皇后問題 |
11+
| euclidean.wy | 歐幾里得法 |
12+
| factorial.wy | 階乘 |
13+
| fibonacci.wy | 斐波那契 |
14+
| fibonacci2.wy | 斐氏列 |
15+
| fizzbuzz.wy | [Fizz buzz][1] |
16+
| hanoi.wy | 漢諾塔 |
17+
| helloworld.wy | 問天地好在 |
18+
| helloworld+.wy | 問天地好在+ |
19+
| import.wy | 導入 |
20+
| mandelbrot.wy | 曼德博集 |
21+
| mergesort.wy | 歸併排序 |
22+
| misc.wy | 雜項 |
23+
| modinv.wy | 大衍求一術 |
24+
| multiplication_table.wy | 乘算口訣 |
25+
| nested_fun.wy | 函数 |
26+
| obj.wy | 对象 |
27+
| pi_leibniz.wy | 萊布尼茲圓周率估算 |
28+
| quicksort.wy | 快速排序 |
29+
| quicksort_inplace.wy | 快速排序2 |
30+
| quine.wy | [自產生程式][2] |
31+
| quine2.wy | 自產生程式2 |
32+
| selectionsort.wy | 選擇排序 |
33+
| sieve.wy | 埃氏篩 |
34+
| sqrt_newton.wy | 牛頓求根法 |
35+
| turing.wy | 圖靈機 |
36+
37+
[1]: https://en.wikipedia.org/wiki/Fizz_buzz "Fizz buzz"
38+
[2]: https://zh.wikipedia.org/wiki/自產生程式 "自產生程式"

test/examples.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function runExample(lang, name, options = {}) {
5151
}
5252

5353
function runAll(lang, options) {
54-
var files = fs.readdirSync(exampleDir);
54+
var files = fs.readdirSync(exampleDir).filter(x => x.endsWith(".wy"));
5555
for (const file of files) {
5656
const filename = file.split(".")[0];
5757
it(filename, () => runExample(lang, filename, options));

tools/make_ide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var execSync = require("child_process").execSync;
77
var parser = require("../src/parser");
88
var utils = require("./utils");
99

10-
var files = fs.readdirSync("../examples/").filter(x => !x.startsWith("."));
10+
var files = fs.readdirSync("../examples/").filter(x => x.endsWith(".wy"));
1111
var prgms = {};
1212
for (var i = 0; i < files.length; i++) {
1313
prgms[files[i].split(".")[0]] = fs

0 commit comments

Comments
 (0)