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:Iustin Pop <iustin@google.com> Reviewed-by:
Balazs Lecz <leczb@google.com>
Loading
Please register or sign in to comment