//! Eval implementations for conditional functions

use hamelin_lib::func::defs::Coalesce;

use crate::registry::EvalRegistry;
use crate::value::Value;

/// Register all conditional function eval implementations.
pub fn register(registry: &mut EvalRegistry) {
    // Coalesce: return first non-null value
    registry.register_eval::<Coalesce>(|mut params| {
        while let Ok(value) = params.take() {
            if !matches!(value, Value::Null) {
                return Ok(value);
            }
        }
        Ok(Value::Null)
    });

    // No reverse eval for conditional functions - they're not invertible
}
