I started with Haskell a few days ago. I have the following piece of code (recursive function):
totaltime t [x] = 0
totaltime t route = tbd + totaltime (t+tbd) (tail(route))
where tbd = timebetweendepartures (fst(route!!0)) (fst(route!!1)) t (snd(route!!1))
"route" is a list of tuples, e.g: [(3,1), (1,2), (5,2), (2,1)]
What I'm trying to do, is to add (0,0) to the route before the function even starts doing what it's supposed to do.
So if the parameter route is passed as [(3,1), (1,2), (5,2), (2,1)] then the function should receive it as [(0,0), (3,1), (1,2), (5,2), (2,1)]
I could just do totaltime t ((0,0):route), but since the function is recursive this won't work as intended.
Ideas are much appreciated!