Prelude function suggestions
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Wed Jul 28 12:24:18 EDT 2004
W liście z śro, 28-07-2004, godz. 18:09 +0200, Peter Simons napisał:
> How about biting the bullet and providing a real "tokenizer"?
You can try using Parsec or another similar library for more complex
tasks.
> tokenize :: (a -> Bool) -> (a -> Bool) -> [a] -> [[a]]
>
> The first function returns 'True' if the the current input
> element is part of a valid token. The second function (the
> "skipper") would return 'True' if the current element is
> ignorable "whitespace".
What if both return True, or if neither returns True?
> Basically, the 'tokenize' function would consume input until
> the first function says "False". Then it would consume (and
> drop) input until the second function says "False". And so
> on, until the end of input string is reached.
This is my SplitSeps (formerly Split1), assuming the second function
is just the negation of the first one.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Libraries
mailing list