]> Repositorios git - scryer-prolog.git/commitdiff
Shrink MVP API surface
authorbakaq <[email protected]>
Sat, 12 Oct 2024 19:58:38 +0000 (16:58 -0300)
committerbakaq <[email protected]>
Sun, 8 Dec 2024 23:18:06 +0000 (20:18 -0300)
src/machine/lib_machine.rs

index e05ed2a6c27cc3c960ce40656c2f5cb7a1d17b02..720cba266b357333c09827c610d2659c1b071d01 100644 (file)
@@ -41,23 +41,6 @@ pub enum LeafAnswer {
     },
 }
 
-impl LeafAnswer {
-    /// True if leaf answer failed.
-    ///
-    /// This gives [`false`] for exceptions.
-    pub fn failed(&self) -> bool {
-        matches!(self, LeafAnswer::False)
-    }
-
-    /// True if leaf answer may have succeeded.
-    ///
-    /// When a leaf answer has residual goals the success is conditional on the satisfiability of
-    /// the contraints they represent. This gives [`false`] for exceptions.
-    pub fn maybe_succeeded(&self) -> bool {
-        matches!(self, LeafAnswer::True | LeafAnswer::LeafAnswer { .. })
-    }
-}
-
 /// Represents a Prolog term.
 #[non_exhaustive]
 #[derive(Debug, Clone, PartialEq)]
@@ -156,25 +139,6 @@ impl Term {
     }
 }
 
-impl From<LeafAnswer> for Term {
-    fn from(value: LeafAnswer) -> Self {
-        match value {
-            LeafAnswer::True => Term::atom("true"),
-            LeafAnswer::False => Term::atom("false"),
-            LeafAnswer::Exception(inner) => match inner.clone() {
-                Term::Compound(functor, args) if functor == "error" && args.len() == 2 => inner,
-                _ => Term::compound("throw", [inner]),
-            },
-            LeafAnswer::LeafAnswer {
-                bindings: _,
-                residual_goals: _,
-            } => {
-                todo!()
-            }
-        }
-    }
-}
-
 /// This is an auxiliary function to turn a count into names of anonymous variables like _A, _B,
 /// _AB, etc...
 fn count_to_letter_code(mut count: usize) -> String {