[obsidian] vault backup: 2023-09-02 22:58:04[

This commit is contained in:
Tomoya Matsuura(MacBookPro) 2023-09-02 22:58:04 +09:00
parent 7e82654d98
commit 2ab0f79f5d

View File

@ -64,6 +64,14 @@ impl<'a, T: Clone> Drop for EnvironmentT<'a, T> {
ので、evalを相互再帰するヘルパー関数とかでこういう感じにした方が楽かも
```rust
fn lookup(env: &mut Vec<(String, Value)>, name: &String) -> Option<Value> {
let res = env
.iter()
.rev()
.filter(|(n, _v)| name == n)
.collect::<Vec<_>>();
res.get(0).map(|(_, v)| v.clone())
}
fn eval_with_new_env<'a>(
e_meta: Box<WithMeta<ast::Expr>>,
env: &'a mut Vec<(String, Value)>,