--- Some generic helper definitions.
module ;
import Stdlib.Prelude open;
--- Concatenates a list of strings
--- ;concat (("a" :: nil) :: "b" :: nil); evaluates to ;"a" :: "b" :: nil;
: List String → String := foldl (++str) "";
--- It inserts the first ;String; at the beginning, in between, and at the end of the second list
(x : String) (xs : List String) : List String :=
(x :: intersperse x xs) ++ x :: nil;
--- It inserts the first ;String; in between the ;String;s in the second list and concatenates the result
(sep : String) (xs : List String) : String :=
concat (intersperse sep xs);
Last modified on 2024-07-11 16:35 UTC