pub fn reduce_or(stack: &mut Vec<Token>) -> Result<Token, RuntimeError> { | |
// would return Err if the vector were not entirely | |
// made of Token::Operand(Type::Bool), since we can't reduce with `or` | |
// other values | |
let bool_result = unwrap_boolean_tokens(stack); | |
if let Ok(bool_vec) = bool_result { | |
Ok(Token::Operand(Type::Bool( | |
bool_vec.iter().any(|b| *b) // and reducer has "all" here | |
))) | |
} else { | |
Err(RuntimeError{ }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment