Skip to content
Snippets Groups Projects
Commit 748d5d50 authored by Iustin Pop's avatar Iustin Pop
Browse files

Generalise the sepSplit function


Currently it works on splitting strings by individual chars, but we
can generalise it to split lists by list elements, which means we can
reuse it later in the Text module for splitting both lists of chars by
'|' or lists of lines by empty newlines. The change also makes the
code cleaner (uses “null xs” instead of string-specific “xs == ""”).

Note: I tried to rewrite this in a nicer, functional style using
unfolds, but I failed to account for the final terminator case
(e.g. ab|cd|) resulting in a valid but empty element.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent aec636b9
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment