-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
08 方術第八中若干问题反馈 #19
Comments
Hi @wglnngt , Thanks a lot for pointing out the issues.
Indeed the first snippet has syntax errors and the second one is syntactically correct. I think the compiler does a correct job of finding the error. e.g. running the first snippet on https://ide.wy-lang.org/ gives:
And javascript: while (true) {
if (藏.length > 層) {
break;
};
var _ans1 = [];
藏.push(_ans1);
}; /*"其它正常循環體中邏輯語句"*/
}; Which seems like the correct behavior. Assuming that you took the snippets out of 賈憲三角 example, I think the confusion might come from the fact that the indentation are garbled due to space/tab issue (now fixed), and that I'm merging some lines to make it read more smoothly and more succint. The actual structure is like so:
So the first part is actually a
Oops, typo. Now corrected in d6761e2 Thanks again for spotting these mistakes! |
感謝回覆與處理。例二反饋確引用不當,感謝指正。 關于例程代碼的簡寫。個人建議可以先按邏輯語法當斷則斷。易于新學者更快理解用法(新學者往往還未建立足夠的關鍵語法敏感度,且之乎者也云云之類,初學之時易就以往漢語語境經驗一眼帶過)。如:
此義一目了然。后跟以簡潔版。
如此,既可明語法之要點,亦可免因疏忽導致的語法問題(上述代碼在最近更新b19072e中,仍少一結束關鍵字云云/也),后加以簡明版代碼,兩相比較,更可彰顯漢語代碼結構之美。:) |
Thanks a lot @wglnngt , I just fixed the missing 云云 mistake: 538a000 My original plan was to use more verbosely formatted examples in the early chapters, and assume by chapter 8 the reader is familiar enough with most wenyan syntaxes that they'll be able to read the condensed ones. I also want to avoid repeating examples twice just for showing whitespace differences. But your suggestion does make a lot of sense too, let me think more about this. Thanks! |
其一:函數定義中的傳参命名,『名之曰』則不可編譯通過,『曰』可正常編譯。
如:
吾有一術。名之曰「論戰」。欲行是術。必先得一言。名之曰「恃」。乃行是術曰。
則編譯出錯。吾有一術。名之曰「論戰」。欲行是術。必先得一言。曰「恃」。乃行是術曰。
則正常運行。其二:循環體與判斷語句重疊時,易產生多收尾或少收尾現象。
如:
編譯正常,但邏輯異常。
則一切正常。
特別是循環體中包含『若非……也』、『若非……云云』的語句,更容易出錯(漏寫或多寫也/云云)。
其三:『篩剔』例中調用例子函數名誤寫爲『濾』。
The text was updated successfully, but these errors were encountered: