Renamed stuff

This commit is contained in:
Erin 2021-12-14 23:02:55 +01:00 committed by ondra05
parent 57939a87b0
commit 6c836125b3
3 changed files with 16 additions and 16 deletions

View file

@ -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()))
}
};

View file

@ -67,8 +67,8 @@ impl Functio {
#[derive(Debug, PartialEq, Copy, Clone, Hash)]
pub enum FunctioChainKind {
Ordered,
Interlaced,
Equal,
ByArity,
}
pub type Cart = HashMap<Value, Rc<RefCell<Value>>>;
@ -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::<Vec<_>>();
@ -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)
)