Modified Str -> Int coercion
This commit is contained in:
parent
85226fbfbb
commit
b76e890fb7
|
@ -213,7 +213,9 @@ impl Value {
|
||||||
},
|
},
|
||||||
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_else(|_| text.chars().map(|cr| cr as isize).sum()),
|
||||||
Value::Cart(c) => c
|
Value::Cart(c) => c
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(i, v)| i.into_isize() * v.borrow().clone().into_isize())
|
.map(|(i, v)| i.into_isize() * v.borrow().clone().into_isize())
|
||||||
|
|
Loading…
Reference in a new issue