Retrait des mots arrêtés dans F #
-
11-11-2019 - |
Question
J'essaie d'écrire un code pour supprimer les mots d'arrêt comme "le", "ce" dans une liste de chaînes, etc.
J'ai écrit ce 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])
J'ai couru ceci dans l'interactif:
stopword (["this";"is";"the"], []);;
J'ai eu cette erreur:
This expression was expected to have type string list but here has type 'a * 'b
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow