view sched/list_schedule.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents f7fb679637ff
children
line wrap: on
line source
% list_action - Make event action from list of times and parameters
%
% list_action ::
%    timed_action({A},{}) ~'the action to perform at each time',
%    seq cell {
%       time ~'time of event',
%       A    ~'argument to pass to action'
%    } ~'the list of times and parameters to action'
% -> time ~'time of first event',
%    msched_action.

function sch=list_schedule(action,X)
	if isempty(X), sch={};
	else e0=head(X); sch={e0{1},@act}; end

	function [err,sch1]=act(t_sched)
		err=action(t_sched,e0{2});
		sch1=list_schedule(action,next(X));
	end
end