use std::ops::Add;
use super::NativeArithmetics;
use crate::array::PrimitiveArray;
use crate::compute::arity::{binary, unary};
pub fn add<T>(lhs: &PrimitiveArray<T>, rhs: &PrimitiveArray<T>) -> PrimitiveArray<T>
where
T: NativeArithmetics + Add<Output = T>,
{
binary(lhs, rhs, lhs.data_type().clone(), |a, b| a + b)
}
pub fn add_scalar<T>(lhs: &PrimitiveArray<T>, rhs: &T) -> PrimitiveArray<T>
where
T: NativeArithmetics + Add<Output = T>,
{
let rhs = *rhs;
unary(lhs, |a| a + rhs, lhs.data_type().clone())
}