diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index f16f94c..1178297 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -501,7 +501,16 @@ impl ops::Sub for Value { ) .into_functio(), }, - Functio::Chain { functios, kind } => todo!(), + Functio::Chain { functios, .. } => { + let rhs = rhs.into_functio(); + let (a, b) = *functios; + + match (a == rhs, b == rhs) { + (_, true) => a, + (true, _) => b, + (_, _) => (Value::Functio(a) - Value::Functio(rhs)).into_functio(), + } + } Functio::Eval(lhs_code) => Functio::Eval(lhs_code.replace( &match rhs.into_functio() { Functio::Eval(code) => code,