Files
quartz-research-note/content/mimiumと多段階計算.md
Matsuura Tomoya(Windows) a5e33b30b3
All checks were successful
Build / build (push) Successful in 17m35s
[obsidian] vault backup: 2025-07-20 10:34:06[
2025-07-20 10:34:06 +09:00

34 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#memo #mimium
- [[多段階計算を命令型VMインストラクションで表現したい]]
- 一時期考えていたが、あんまり筋が良くないのでやめた
[Implement multi-stage computation intepreter by tomoyanonymous · Pull Request #136 · mimium-org/mimium-rs · GitHub](https://github.com/mimium-org/mimium-rs/pull/136)
シンプルに構文木レベルでのインタプリタを別途作ることで実現できそう。
## 課題
- 組み込みの関数の型情報がマクロ用レベル0とVM用レベル1で分かれているので、両方にあることを別々に宣言しなければならない
- 逆に、ベクターのappend・removeや文字列操作など、メモリを確保する操作はレベル0でのみ利用できる組み込み関数として制限すると、便利かもしれない
- 逆に、`self``delay`はレベル1でのみ利用できる関数とする
- レベル01両方で利用できるpersistentなモジュールは、上記2種類のいずれも使わず、かつescapeとBracketも利用しないものであればよい、ということになる
- もともとディレイの最大サイズはリテラルで指定しなければいけないという問題があったが、これを`make_delay(size:float)-> <(float,float)->float>`レベル0で最大時間を指定すると、入力と遅延時間をとる関数のコードを返すという関数にできるかも
- ただ、これやるとディレイが絡む関数はすべてレベル0定義になるのかな
- なんかそれよりは、[[数値プリミティブ型に常に範囲をつける]]とかのほうが筋がいいかも
```rust
fn fbdelay(max_time){
`|input,time,fb| {
(input + self*fb, time) |> make_delay!(max_time)
}
}
```
-