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]

[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]

The value space of a domain. The inputs of every primitive and the result of every evaluation must be of this type. Read more

[src]

[src]

Auto Trait Implementations

impl<V, F> Send for SimpleEvaluator<V, F> where
    F: Send,
    V: Send

impl<V, F> Sync for SimpleEvaluator<V, F> where
    F: Sync,
    V: Sync