pub struct SimpleEvaluator<V, R, F>(/* private fields */);Expand description
Trait Implementations§
Source§impl<V, R, F> Evaluator for SimpleEvaluator<V, R, F>
impl<V, R, F> Evaluator for SimpleEvaluator<V, R, F>
Source§type Space = V
type Space = V
The value space of a domain. The inputs of every primitive and the result of every
evaluation must be of this type.
fn evaluate( &self, primitive: &str, inps: &[Self::Space], ) -> Result<Self::Space, Self::Error>
fn lift(&self, _f: LiftedFunction<Self::Space, Self>) -> Option<Self::Space>
Source§impl<V, R, F> From<F> for SimpleEvaluator<V, R, F>
impl<V, R, F> From<F> for SimpleEvaluator<V, R, F>
Source§fn from(f: F) -> Self
fn from(f: F) -> Self
Create a SimpleEvaluator out of a function that takes a primitive name and a list of
arguments.
§Examples
use programinduction::lambda::SimpleEvaluator;
fn evaluate(primitive: &str, inp: &[bool]) -> Result<bool, ()> {
match primitive {
"nand" => Ok(!(inp[0] & inp[1])),
_ => unreachable!(),
}
}
let eval = SimpleEvaluator::from(evaluate);Auto Trait Implementations§
impl<V, R, F> Freeze for SimpleEvaluator<V, R, F>where
F: Freeze,
impl<V, R, F> RefUnwindSafe for SimpleEvaluator<V, R, F>where
F: RefUnwindSafe,
impl<V, R, F> Send for SimpleEvaluator<V, R, F>where
F: Send,
impl<V, R, F> Sync for SimpleEvaluator<V, R, F>where
F: Sync,
impl<V, R, F> Unpin for SimpleEvaluator<V, R, F>where
F: Unpin,
impl<V, R, F> UnwindSafe for SimpleEvaluator<V, R, F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more