Cart -> Int more cursed

This commit is contained in:
Erin 2022-01-22 20:52:09 +01:00 committed by ondra05
parent 3f29fb09cd
commit a3a9b777ad

View file

@ -122,10 +122,14 @@ impl Value {
match self { match self {
Value::Abool(a) => a as _, Value::Abool(a) => a as _,
Value::Bool(b) => b as _, Value::Bool(b) => b as _,
Value::Functio(_) => self.len(),
Value::Int(i) => i, Value::Int(i) => i,
Value::Nul => consts::ANSWER, Value::Nul => consts::ANSWER,
Value::Str(text) => text.parse().unwrap_or(consts::ANSWER), Value::Str(text) => text.parse().unwrap_or(consts::ANSWER),
_ => self.len() as _, Value::Cart(c) => c
.into_iter()
.map(|(i, v)| i.into_i32() * v.borrow().clone().into_i32())
.sum(),
} }
} }