view arrows/afield.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
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