summaryrefslogtreecommitdiff
path: root/my_list.mli
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2018-07-11 21:16:00 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2018-07-11 21:16:00 +0200
commit54031d742675d9bab6bbf7621434cc2476135a1e (patch)
treed2ed6de928d62e8854440098508b39298c3fcddb /my_list.mli
parent5374fa0f4b0e2e8fb93fb73ee3a1abef84c0b786 (diff)
Add the flatten (concat) function
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'my_list.mli')
-rw-r--r--my_list.mli5
1 files changed, 5 insertions, 0 deletions
diff --git a/my_list.mli b/my_list.mli
index 72535d5..4644a74 100644
--- a/my_list.mli
+++ b/my_list.mli
@@ -70,3 +70,8 @@ let rec append l1 l2 =
(** Return a list which results in the concatenation of reversed l1 and l2. *)
let rev_append l1 l2 =
append (rev l1) l2
+
+(** Return a list consisting of the contenation of the given list of lists. *)
+let rec flatten = function
+ | Item(hd, tl) -> append hd (flatten tl)
+ | None -> None