Rewording a few comments in eval::fixpoint
-//! Helper to compute the fixpoint of a recursive record.
+//! Compute the fixpoint of a recursive record.
use super::*;
-/// Build a recursive environment from an iterator of bindings. For each binding, extract the thunk
-/// from the passed environment, and return it in the result. The resulting environment can then be
-/// passed to the [`patch_field`] function.
+/// Build a recursive environment from record bindings. For each field, `rec_env` either extracts
+/// the corresponding thunk from the environment in the general case, or create a closure on the
+/// fly if the field is a constant. The resulting environment is to be passed to the
+/// [`patch_field`] function.
pub fn rec_env<'a, I: Iterator<Item = (&'a Ident, &'a RichTerm)>>(
bindings: I,
env: &Environment,
@@ -30,8 +31,8 @@ pub fn rec_env<'a, I: Iterator<Item = (&'a Ident, &'a RichTerm)>>(
.collect()
}
-/// Take a [`RichTerm`] that is stored inside a field, and patch its environment by enriching it
-/// with the recursive environment.
+/// Patch the environment of the content of a recursive record field by extending it with a
+/// recursive environment.
pub fn patch_field(
rt: &RichTerm,
rec_env: &Vec<(Ident, Thunk)>,
@@ -43,8 +44,8 @@ pub fn patch_field(
.ok_or_else(|| EvalError::UnboundIdentifier(var_id.clone(), rt.pos))?;
thunk.borrow_mut().env.extend(rec_env.iter().cloned());
}
- // Thanks to the share normal form transformation, the content is either a
- // constant or a variable. In the constant case, the environment is irrelevant,
- // we we don't have to do anyting in the else case.
+ // Thanks to the share normal form transformation, the content is either a constant or a
+ // variable. In the constant case, the environment is irrelevant and we don't have to do
+ // anything in the `else` case.
Ok(())
}
