% st_schedule - Make state-threading event action from state transformer and state
%
% st_schedule ::
%    timed_action({A},{time,A}) ~'the action to perform at each time',
%    time ~'time of first event',
%    A    ~'initial state'
% -> schedule.

function sch0=st_schedule(action,t0,s0)
	if isempty(s0), sch0={};
	else sch0={t0,@act}; end

	function [err,sch1]=act(t_sched)
		[err,t1,s1]=action(t_sched,s0);
		sch1=st_schedule(action,t1,s1);
	end
end
