Added directfs

Added a very rudimentary file I/O system suitable for experimenting
with the language further. A better one will be designed when we have
sensible error management.
This commit is contained in:
2023-09-17 16:37:39 +01:00
parent 1078835e8b
commit 7396078304
84 changed files with 563 additions and 721 deletions

View File

@@ -48,6 +48,7 @@ fn map_at<E>(
/// Replace the [Clause::LambdaArg] placeholders at the ends of the [PathSet]
/// with the value in the body. Note that a path may point to multiple
/// placeholders.
#[must_use]
fn substitute(paths: &PathSet, value: Clause, body: ExprInst) -> ExprInst {
let PathSet { steps, next } = paths;
unwrap_always(map_at(steps, body, &mut |checkpoint| -> Always<Clause> {

View File

@@ -21,6 +21,7 @@ pub struct HandlerTable<'a> {
}
impl<'a> HandlerTable<'a> {
/// Create a new [HandlerTable]
#[must_use]
pub fn new() -> Self { Self { handlers: HashMap::new() } }
/// Add a handler function to interpret a type of atom and decide what happens
@@ -46,6 +47,7 @@ impl<'a> HandlerTable<'a> {
}
/// Combine two non-overlapping handler sets
#[must_use]
pub fn combine(mut self, other: Self) -> Self {
for (key, value) in other.handlers {
let prev = self.handlers.insert(key, value);