annotate 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
rev   line source
samer@0 1 % afield - arrow to extract named field from structure
samer@0 2 %
samer@0 3 % afield :: N:string ~'field name' -> arrow({struct{N::T;}, {T}, empty).
samer@0 4 %
samer@0 5 % If input is structure with a field named N of type T,
samer@0 6 % the single output is of type T.
samer@0 7 function o=afield(nm,sz)
samer@0 8 o=arr(@(x)getfield(x,nm),'sizefn',@(s){sz});
samer@0 9 end