[Haskell-beginners] Things which predictedly change over time

Martin Drautzburg Martin.Drautzburg at web.de
Thu Jan 17 21:34:36 CET 2013


Hello all,

... and I thought this was easy: 

find a way to represent a "schedule", i.e. a thing which assumes different 
values at different days.

It turned out I don't know what a schedule is. What is the formalism behind 
"This train leaves at 11:00 every day except sundays (where it doesn't run at 
all), except on Easter Sunday where it leaves at 11:10"?

I do not even need to know the "most compact" representation, just some 
representation which is reasonably compact and which can be translated into 
human language.

So far I believe a Schedule is a function which takes a day and retuns a 
Value. If I had this function, I could easily list values for all days within 
given interval of days.

But the inverse should also be possible. Given a List of (Day, Value) pairs, I 
should be able to construct a Schedule.

The reason why I am interested in this is the following: 

"On every Monday I take a trip from A to C. To do so, I need to take two 
trains and change trains in B". 

So I have to consider the two train schedules to decide whether or not my 
itinerary will work. So I kind of have a Constraint which is scheduled itself 
(every Monday) and which depends on two other Schedules. The Constraint can be 
satisfied for some days and violated for others. I want to find out when it is 
violated (within a finit interval of days) without having to enumerate all 
days and check each day individually. 

And most importantly I want to specify the Constraint without referring to 
individual days, just like I did in the quoted sentence above.

You may also say, I want to lift the fine world of relational algebra to a 
world where things change over time, i.e. assume different values at different 
days.

This seems to be such a common planning problem! You face it every time you 
deal with things which are not constant over time, and it becomes a nightmare 
when you deal with relationships between them. Still I could not find anything 
useful on the net. How can the world turn at all without having this solved?



-- 
Martin



More information about the Beginners mailing list