samer@10: % bracket_it - Bracket iterator with pre and post actions samer@10: % samer@10: % bracket_it :: samer@10: % iterator(A) ~'an iterator', samer@10: % (A=>void) ~'action to perform before calling iterator', samer@10: % (A=>void) ~'action to perform after calling iterator' samer@10: % -> iterator(A) ~'new iterator incorporating pre and post actions'. samer@10: function it=bracket_it(it,pre,post) samer@10: f=it{1}; it{1}=@bf; samer@10: function x=bf(x), pre(x); x=f(x); post(x); end samer@10: end