Cart -> Int more cursed
This commit is contained in:
parent
3f29fb09cd
commit
a3a9b777ad
|
@ -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