From e2c7a33a59d15f0951b31d358359e6abf557c9b4 Mon Sep 17 00:00:00 2001 From: Erin Date: Sun, 29 Aug 2021 00:34:08 +0200 Subject: [PATCH] fmt + docs --- ablescript/src/variables.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index a558ce33..dca83714 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -93,11 +93,17 @@ impl Value { Value::Abool(a) => a as _, Value::Bool(b) => b as _, Value::Functio(func) => match func { + // Compares lengths of functions: + // BfFunctio - Sum of lengths of instructions and length of tape + // AbleFunctio - Sum of argument count and body length + // Eval - Length of input code Functio::BfFunctio { instructions, tape_len, } => (instructions.len() + tape_len) as _, - Functio::AbleFunctio { params, body } => (params.len() + format!("{:?}", body).len()) as _, + Functio::AbleFunctio { params, body } => { + (params.len() + format!("{:?}", body).len()) as _ + } Functio::Eval(s) => s.len() as _, }, Value::Int(i) => i,