Question

I am trying to write a code to remove stopwords like "the", "this" in a string list etc.

I wrote this code:

let rec public stopword (a : string list, b :string list) =

    match [a.Head] with
        |["the"]|["this"] -> stopword (a.Tail, b)
        |[] -> b
        |_ ->  stopword (a.Tail, b@[a.Head])

I ran this in the interactive:

stopword (["this";"is";"the"], []);;

I got this error:

This expression was expected to have type string list but here has type 'a * 'b

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top