aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2018-02-12 13:28:39 -0500
committerGravatar Jason Gross <jgross@mit.edu>2018-02-24 15:41:22 -0500
commit6e3f45cf27bea67dd87ed824396a662f904c93e8 (patch)
tree0a0b54431b0694ff370878e48a7c3bbc0d7dfa0a /theories
parente3124e098ef8170dac2b348b91757a7034bc4999 (diff)
Add String.concat
Diffstat (limited to 'theories')
-rw-r--r--theories/Strings/String.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/theories/Strings/String.v b/theories/Strings/String.v
index c39b47fb1..d5852345b 100644
--- a/theories/Strings/String.v
+++ b/theories/Strings/String.v
@@ -163,6 +163,18 @@ intros n0 H; apply Rec; simpl; auto.
apply Le.le_S_n; auto.
Qed.
+(** *** Concatenating lists of strings *)
+
+(** [concat sep sl] concatenates the list of strings [sl], inserting
+ the separator string [sep] between each. *)
+
+Fixpoint concat (sep : string) (ls : list string) :=
+ match ls with
+ | nil => EmptyString
+ | cons x nil => x
+ | cons x xs => x ++ sep ++ concat sep xs
+ end.
+
(** *** Test functions *)
(** Test if [s1] is a prefix of [s2] *)