From 1c150e5a047fdf410572960c3760888a9a467c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabrielle=20Guimar=C3=A3es=20de=20Oliveira?= Date: Thu, 21 Dec 2023 20:29:57 -0300 Subject: [PATCH] feat: use for instead of extend --- src/eval.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index de4bd07..68c8c8c 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -231,18 +231,14 @@ impl Fun { loop { let mut current_environment = self.environment.frames.write().unwrap(); - let mut frame = current_environment.back_mut().unwrap(); - let new_environment = associate_parameters(self.parameters.clone(), arguments.clone())? - .into_iter() - .map(|(keyword, value)| { - (keyword.clone(), Definition { - is_macro_definition: false, - name: keyword.name, - value, - }) + let frame = current_environment.back_mut().unwrap(); + for (name, value) in associate_parameters(self.parameters.clone(), arguments.clone())? { + frame.definitions.insert(name.clone(), Definition { + is_macro_definition: false, + name: name.name, + value, }); - - frame.definitions.extend(new_environment); + } } } }