Getting named attributes when using higher-order functions