
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@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/