Cart -> Int more cursed
This commit is contained in:
parent
2191e126f0
commit
7cf9433462
|
@ -122,10 +122,14 @@ impl Value {
|
|||
match self {
|
||||
Value::Abool(a) => a as _,
|
||||
Value::Bool(b) => b as _,
|
||||
Value::Functio(_) => self.len(),
|
||||
Value::Int(i) => i,
|
||||
Value::Nul => 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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue