annotate arrows/afield.m @ 42:ae596261e75f
Various fixes and development to audio handling
author |
samer |
date |
Tue, 02 Dec 2014 14:51:13 +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
|