harukamm / ocaml-blockly Goto Github PK
View Code? Open in Web Editor NEWOCaml visual programming editor based on Blockly.
License: Apache License 2.0
OCaml visual programming editor based on Blockly.
License: Apache License 2.0
(レコードのサポート、ありがとうございます。)
現在、match 文で、レコードのパターンを使うと、パターン変数に同じ変数がデフォルトで入っていますが、異なる変数にしたいです。加えて、ユーザが同じ名前のパターン変数に rename しようとしたら拒否したいです。
match文の中のパターンお砂場に、リストやペアのパターンブロックはおくことができますが、レコードパターンブロックについては、「レコード〇〇が定義されていない場所です」のエラーメッセージが出て、おくことができません。(なお、パターンとして、外の世界で、match文のブロックと組むことは、もちろんできます。)
http://pllab.is.ocha.ac.jp/~asai/class/wiki/asailab/index.php?OCaml19 より引用。
参照:デザインレシピ
http://pllab.is.ocha.ac.jp/~asai/class/wiki/asailab/index.php?OCaml19 より引用。
現在は、文字列結合を行うブロックは、2つの文字列を結合するものに限られていて、3つ以上の文字列を結合したいときには、文字列結合のブロックを入れ子にする必要があります。
そこで、
type ekimei_t = {kanji : string; kana : string; romaji : string; ken : string; shozoku : string}
let hyoji eki = match eki with
| {kanji = a; kana = b; romaji = c; ken = d; shozoku = e} -> d ^ ":" ^ e ^ "," ^ a ^ "(" ^ b ^ ")"
上のようにekimei_t型の駅情報を文字列にする関数を定義してみたところ次のようになりました。
入れ子が複雑になると可読性?が落ちる気がするので、リスト構造のように可変長ブロックにしてはどうでしょうか。(結合法則の仕組み等の問題が発生するのでしょうか。)
(日本語で失礼しました。)
match ブロックを出し、パターンワークベンチを出して、pair または x :: xs を選び、一度、それを match ブロックのパターンのところに接続する。そのあと、それを外してパターンワークベンチに置こうとするとクラッシュするっぽい。
match 文でレコードのパターンを使った際、そのパターンの矢印の右側ではパターン変数を普通の変数としてドラッグして使えるようにしたいです。現在は、x :: xs のパターンなら x や xs をドラッグできますが、レコードのパターン変数はドラッグできないようです。加えて、これらのパターン変数がスコープお砂場にも現れて欲しいです。
This issue is already added to TODO list. See ed9ec12.
整数の二項演算子は +
-
×
÷
が表示されますが、実数の二項演算子が +.
-.
*.
/.
なのもあり、実際の OCaml での記号 +
-
*
/
であってほしいです。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.