Mercurial > hg > ishara
annotate general/algo/bracket_it.m @ 10:f7fb679637ff
Imported some more functions.
author | samer |
---|---|
date | Mon, 14 Jan 2013 15:51:53 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@10 | 1 % bracket_it - Bracket iterator with pre and post actions |
samer@10 | 2 % |
samer@10 | 3 % bracket_it :: |
samer@10 | 4 % iterator(A) ~'an iterator', |
samer@10 | 5 % (A=>void) ~'action to perform before calling iterator', |
samer@10 | 6 % (A=>void) ~'action to perform after calling iterator' |
samer@10 | 7 % -> iterator(A) ~'new iterator incorporating pre and post actions'. |
samer@10 | 8 function it=bracket_it(it,pre,post) |
samer@10 | 9 f=it{1}; it{1}=@bf; |
samer@10 | 10 function x=bf(x), pre(x); x=f(x); post(x); end |
samer@10 | 11 end |