locrian 0.1.0

A simple embeddable functional programming language.
Documentation
use crate::eval::EvalResult;

pub(crate) fn concat(args: Vec<EvalResult>) -> EvalResult {
    EvalResult::String(
        args.iter()
            .map(|val| format!("{}", val))
            .collect::<Vec<_>>()
            .concat(),
    )
}

#[cfg(test)]
mod tests {

    use crate::{eval::EvalResult, eval_str, stdlib::STDLIB};

    #[test]
    fn test_concat() {
        assert_eq!(
            eval_str("concat(\"hello\", \" \", \"world\", 3)", STDLIB.clone()).unwrap(),
            EvalResult::String("hello world3".to_string())
        );
    }
}