bergsoe avatar bergsoe committed ccaed2c

Revision of PaplTime.Path.concat.

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

Comments (0)

Files changed (2)

 
   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.)
 (** [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
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.