james woodyatt  committed 7c6c614

Add seqf1 to Cf_llscan.

  • Participants
  • Parent commits 8dad598
  • Branches sideline

Comments (0)

Files changed (2)

File cf/

     | None -> Some (a, s)
     | Some (r, s) -> seqf f (f a r) p s
+let seqf1 f a p s =
+    match p s with
+    | None -> None
+    | Some (r, s) -> seqf f (f a r) p s
 let rec alt ps s =
     match ps with
     | [] -> None

File cf/cf_llscan.mli

 val seqf: ('a -> 'r -> 'a) -> 'a -> ('s, 'r) t -> ('s, 'a) t
+(** Use [seqf1 f a p] to create a scanner that recognizes one or more instances
+    of the pattern recognized by [p] and returns the result of folding the
+    application [f] into the outputs of each scanner using the initial state
+    [a].
+val seqf1: ('a -> 'r -> 'a) -> 'a -> ('s, 'r) t -> ('s, 'a) t
 (** Use [alt ps] to create a scanner that produces the output from the first
     scanner in the list [ps] that recognizes a pattern in the input.  If no
     scanner in the list recognizes a pattern, then the scanner constructed by