Add filter, map, reduce to Array.

This commit is contained in:
Stephen Chung
2020-10-12 22:49:51 +08:00
parent 6d0851de44
commit 747fda1ec7
6 changed files with 258 additions and 49 deletions

View File

@@ -5,6 +5,9 @@ use crate::error::ParseErrorType;
use crate::parser::INT;
use crate::token::Position;
#[cfg(not(feature = "no_function"))]
use crate::engine::is_anonymous_fn;
use crate::stdlib::{
boxed::Box,
error::Error,
@@ -166,6 +169,10 @@ impl fmt::Display for EvalAltResult {
Self::ErrorParsing(p, _) => write!(f, "Syntax error: {}", p)?,
#[cfg(not(feature = "no_function"))]
Self::ErrorInFunctionCall(s, err, _) if is_anonymous_fn(s) => {
write!(f, "Error in call to closure: {}", err)?
}
Self::ErrorInFunctionCall(s, err, _) => {
write!(f, "Error in call to function '{}': {}", s, err)?
}