Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2018 11:44
What would you like to do?
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 {
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