diff --git a/able-script-test/interlace.able b/able-script-test/by-arity-chain.able similarity index 100% rename from able-script-test/interlace.able rename to able-script-test/by-arity-chain.able diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index 40c26369..bcf0cff5 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -409,12 +409,12 @@ impl ExecEnv { Functio::Chain { functios, kind } => { let (left_functio, right_functio) = *functios; let (left_args, right_args) = match kind { - crate::variables::FunctioChainKind::Ordered => { + crate::variables::FunctioChainKind::Equal => { let (l, r) = args.split_at(args.len() / 2); // TODO: avoid this clone (l.to_owned(), r.to_owned()) } - crate::variables::FunctioChainKind::Interlaced => { + crate::variables::FunctioChainKind::ByArity => { Self::deinterlace(args, (left_functio.arity(), right_functio.arity())) } }; diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index c5b933f8..90d00b6f 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -67,8 +67,8 @@ impl Functio { #[derive(Debug, PartialEq, Copy, Clone, Hash)] pub enum FunctioChainKind { - Ordered, - Interlaced, + Equal, + ByArity, } pub type Cart = HashMap>>; @@ -135,11 +135,11 @@ impl Value { Functio::Chain { functios, kind } => { let (lhs, rhs) = *functios; match kind { - FunctioChainKind::Ordered => { + FunctioChainKind::Equal => { Value::Int(Value::Functio(lhs).into_i32()) + Value::Int(Value::Functio(rhs).into_i32()) } - FunctioChainKind::Interlaced => { + FunctioChainKind::ByArity => { Value::Int(Value::Functio(lhs).into_i32()) * Value::Int(Value::Functio(rhs).into_i32()) } @@ -225,11 +225,11 @@ impl Value { Functio::Chain { functios, kind } => { let (lhs, rhs) = *functios; match kind { - FunctioChainKind::Ordered => { + FunctioChainKind::Equal => { Value::Abool(Value::Functio(lhs).into_abool()) + Value::Abool(Value::Functio(rhs).into_abool()) } - FunctioChainKind::Interlaced => { + FunctioChainKind::ByArity => { Value::Abool(Value::Functio(lhs).into_abool()) * Value::Abool(Value::Functio(rhs).into_abool()) } @@ -292,9 +292,9 @@ impl Value { .get(&Value::Str("1452251871514141792252515212116".to_owned())) .map(|x| x.borrow().to_owned().into_i32()) { - FunctioChainKind::Ordered + FunctioChainKind::Equal } else { - FunctioChainKind::Interlaced + FunctioChainKind::ByArity }; let mut cart_vec = c.iter().collect::>(); @@ -394,11 +394,11 @@ impl Value { Functio::Chain { functios, kind } => { let (lhs, rhs) = *functios; match kind { - FunctioChainKind::Ordered => { + FunctioChainKind::Equal => { Value::Cart(Value::Functio(lhs).into_cart()) + Value::Cart(Value::Functio(rhs).into_cart()) } - FunctioChainKind::Interlaced => { + FunctioChainKind::ByArity => { Value::Cart(Value::Functio(lhs).into_cart()) * Value::Cart(Value::Functio(rhs).into_cart()) } @@ -434,7 +434,7 @@ impl ops::Add for Value { } Value::Functio(f) => Value::Functio(Functio::Chain { functios: Box::new((f, rhs.into_functio())), - kind: FunctioChainKind::Ordered, + kind: FunctioChainKind::Equal, }), Value::Cart(c) => { Value::Cart(c.into_iter().chain(rhs.into_cart().into_iter()).collect()) @@ -565,7 +565,7 @@ impl ops::Mul for Value { } Value::Functio(f) => Value::Functio(Functio::Chain { functios: Box::new((f, rhs.into_functio())), - kind: FunctioChainKind::Interlaced, + kind: FunctioChainKind::ByArity, }), Value::Cart(c) => { let rhsc = rhs.into_cart(); @@ -807,8 +807,8 @@ impl Display for Value { "{} {} {} ", Value::Functio(a), match kind { - FunctioChainKind::Ordered => '+', - FunctioChainKind::Interlaced => '*', + FunctioChainKind::Equal => '+', + FunctioChainKind::ByArity => '*', }, Value::Functio(b) )