annotate 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 |
|
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
|