Trait nock::Nock
[−]
[src]
pub trait Nock { fn call(&mut self, subject: &Noun, formula: &Noun) -> Option<NockResult> { ... } fn hint(
&mut self,
subject: &Noun,
hint: &Noun,
c: &Noun
) -> Result<(), NockError> { ... } fn nock_on(&mut self, subject: Noun, formula: Noun) -> NockResult { ... } }
Interface for a virtual machine for Nock code.
A virtual machine can process Hint operations and accelerate Call operations.
Provided Methods
fn call(&mut self, subject: &Noun, formula: &Noun) -> Option<NockResult>
Accelerate computation of a formula, if possible.
Nock *[a 9 b c]
, will trigger call(*[a c], *[*[a c] 0 b])
.
If call returns a noun, that noun will be used as the result of the
Nock evaluation. Otherwise the formula will be evaluated as standard
Nock.
The return value must be exactly the same as you would get for evaluating the formula on the subject with a standard Nock interpreter.
fn hint(
&mut self,
subject: &Noun,
hint: &Noun,
c: &Noun
) -> Result<(), NockError>
&mut self,
subject: &Noun,
hint: &Noun,
c: &Noun
) -> Result<(), NockError>
Handle a Nock hint.
Nock *[a 10 b c]
will trigger hint(a, b, c)
.
fn nock_on(&mut self, subject: Noun, formula: Noun) -> NockResult
Evaluate the nock *[subject formula]