I understand that F# functions return a unit if nothing else is returned, but this function returns a string. Can someone please help me understand why it returns a unit?
let rec processList aList str =
match aList with
| h::t -> let x = Regex.Replace(str, h, h, RegexOptions.IgnoreCase)
processList t x
| [] -> printfn "%s" str
The stopping case for this recursive function | [] -> printfn "%s" str
returns unit, and therefore the function returns a unit. The other branch only recursively call the same function.