view sched/st_schedule.m @ 38:9d24b616bb06

Added function algebra.
author samer
date Tue, 29 Jan 2013 15:59:01 +0000
parents f7fb679637ff
children
line wrap: on
line source
% 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