Skip to content
  • Iustin Pop's avatar
    Generalise the sepSplit function · 748d5d50
    Iustin Pop authored
    
    
    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>
    748d5d50