[Haskell-cafe] take the keywords from a string
ndmitchell at gmail.com
Sat Jun 17 18:50:11 EDT 2006
> This function will take the input as a string and return a list of
> keywords taken from the input string and they are elements of
> ListOfKeywords. The order of the result list is sequenced as: the last
> keyword found is set as the first element of the list, and so on.
It looks like your language is quite Haskell like, so you can use the
built in lex function to split a string into a list. Then a simple
filter (`elem` listOfKeywords) will pick out the keywords for you.
As for the ordering, maybe you want to apply reverse at the end?
More information about the Haskell-Cafe