Struct programinduction::lambda::SimpleEvaluator
[−]
[src]
pub struct SimpleEvaluator<V, F>(_, _);
An Evaluator defined solely by a function.
Use of to create one. Incapable of dealing with first-class functions.
Methods
impl<V, F> SimpleEvaluator<V, F> where
V: Clone + PartialEq + Send + Sync,
F: Fn(&str, &[V]) -> V, [src]
V: Clone + PartialEq + Send + Sync,
F: Fn(&str, &[V]) -> V,
pub fn of(f: F) -> Self[src]
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]) -> bool { match primitive { "nand" => !(inp[0] & inp[1]), _ => unreachable!(), } } let eval = SimpleEvaluator::of(evaluate);
Trait Implementations
impl<V, F> Evaluator for SimpleEvaluator<V, F> where
V: Clone + PartialEq + Send + Sync,
F: Fn(&str, &[V]) -> V + Sync, [src]
V: Clone + PartialEq + Send + Sync,
F: Fn(&str, &[V]) -> V + Sync,
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. Read more
fn evaluate(&self, primitive: &str, inps: &[Self::Space]) -> Self::Space[src]
fn lift(&self, _f: LiftedFunction<Self::Space, Self>) -> Result<Self::Space, ()>[src]
Auto Trait Implementations
impl<V, F> Send for SimpleEvaluator<V, F> where
F: Send,
V: Send,
F: Send,
V: Send,
impl<V, F> Sync for SimpleEvaluator<V, F> where
F: Sync,
V: Sync,
F: Sync,
V: Sync,