forked from Orchid/orchid
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:
@@ -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> {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user