Mercurial > hg > ishara
comparison 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 |
comparison
equal
deleted
inserted
replaced
43:62e31e7980e6 | 44:3cedfd4549ef |
---|---|
1 % with_field - Apply operator to structure | |
2 % with_field :: | |
3 % N:string ~'field name', | |
4 % (A->B) ~'function' | |
5 % -> (struct { N : A } -> struct { N : B}). | |
6 function g=with_field(nm,f) | |
7 g=@op; | |
8 function x=op(x), x.(nm)=f(x.(nm)); end | |
9 end |