Pregunta

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 hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top