Commits

bergsoe  committed ccaed2c

Revision of PaplTime.Path.concat.

New API doc, new signature, and a more sane semantics.

  • Participants
  • Parent commits e4c8f94

Comments (0)

Files changed (2)

File src/PaplTime.ml

 
   let shift path dt = List.map (fun qt -> add_time qt dt) path
 
-  let concat paths =
+  let concat ?(t0 = 0.) paths =
     let rec loop paths time =
       match paths with
           [] -> []
-        | [] :: paths -> loop paths time
-        | (qt :: _) as path :: paths ->
-            let t0 = qt.time in
-            let (path, time) = shift_helper path (time -. t0) in
+        | path :: paths ->
+            let (path, time) = shift_helper path time in
               path :: loop paths time
     in
       List.concat (loop paths 0.)

File src/PaplTime.mli

 (** [shift path dt] shifts [path] by adding [dt] to all time values.
 *)
 
-  val concat : 'a t list list -> 'a t list
-(** [concat ~t0 paths] concatenates [paths].
+  val concat : ?t0:float -> 'a t list list -> 'a t list
+(** Concatenation of time-stamped paths.
+
+    [concat ~t0 paths] concatenates [paths] as if they were ordinary lists but
+    time shifts each path to align with the previous path.
+
+    The first path is time shifted by [~t0] ([0.0] by default). The next path is
+    time shifted by the time of the last configuration of the previously shifted
+    path.
 *)
 end