aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2018-03-07 11:40:05 +0100
committerGravatar Maxime Dénès <mail@maximedenes.fr>2018-03-07 11:40:05 +0100
commit144517d764f11b8b79e8f7adfeca0d075dd4ac19 (patch)
treeb6dd25f3b6df4183badbefa85d365024507b3c96 /theories
parentca1310d887204f467aae545a11a8d28e763ff24a (diff)
parent6e3f45cf27bea67dd87ed824396a662f904c93e8 (diff)
Merge PR #6744: 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 a302b8329..2be6618ad 100644
--- a/theories/Strings/String.v
+++ b/theories/Strings/String.v
@@ -165,6 +165,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] *)