Hello this function should take a String and return a list of Strings split at the Char c. I should define some helper functions but currently the user must initialize args that should be hidden from them.
xs = output list, i = start index for substr, j = end index for substr
example: split "123,456,789" ',' [] 0 0
should yield ["789", "456", "123"]
split s c xs i j =
if j == length s
then (subStr s i j) : xs
else if head (drop j s) == c
then split s c (subStr s i j : xs) (j + 1) (j + 1)
else split s c xs i (j + 1)
subStr s i j = take j(drop i s)
When i apply the function with the following args: split "123,456,789" ',' [] 0 0
I'm getting the result: ["789", "456,789", "123"]