Mercurial > hg > ishara
annotate general/funutils/@function_handle/with_field.m @ 44:3cedfd4549ef
Code added since initial check in.
author | samer |
---|---|
date | Tue, 13 Jan 2015 14:03:17 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@44 | 1 % with_field - Apply operator to structure |
samer@44 | 2 % with_field :: |
samer@44 | 3 % N:string ~'field name', |
samer@44 | 4 % (A->B) ~'function' |
samer@44 | 5 % -> (struct { N : A } -> struct { N : B}). |
samer@44 | 6 function g=with_field(nm,f) |
samer@44 | 7 g=@op; |
samer@44 | 8 function x=op(x), x.(nm)=f(x.(nm)); end |
samer@44 | 9 end |