view arrows/alatch.m @ 2:7357e1dc2ad6

Simplified scheduler library with new schedule representation.
author samer
date Sat, 22 Dec 2012 16:17:51 +0000
parents 672052bd81f8
children ae596261e75f
line wrap: on
line source
% alatch - Arrow which produced the value in the last event received.
%
% alatch :: A -> arrow( {box(A)}, {A}, A).
function o=alatch(x0)
	o=loop(@upd,@(sz)x0);
end

function [y,s]=upd(x,s)
	if iscell(x) && ~isempty(x), s=x{end}; end
	y=s;
end