view arrows/afield.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% afield - arrow to extract named field from structure
%
% afield :: N:string ~'field name' -> arrow({struct{N::T;}, {T}, empty).
%
% If input is structure with a field named N of type T,
% the single output is of type T.
function o=afield(nm,sz)
	o=arr(@(x)getfield(x,nm),'sizefn',@(s){sz});
end