Created
October 7, 2008 02:20
-
-
Save stevewillard/15217 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> module Scan where | |
> import Char | |
> tokenize [] = [] | |
> tokenize (x:xs) | |
> | isSpace x = tokenize xs | |
> | isDigit x = fst (span isDigit (x:xs)) : tokenize (snd (span isDigit (x:xs))) | |
> | isAlpha x = fst (span isAlpha (x:xs)) : tokenize (snd (span isAlpha (x:xs))) | |
> | isSym x = fst (span isSym (x:xs)) : tokenize (snd (span isSym (x:xs))) | |
> isSym c = c `elem` "!@#$%&*+./<=>?\\^|:-~()" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment