[Haskell-beginners] doubt....plz help me out
jean verdier
verdier.jean at gmail.com
Tue Oct 18 08:13:52 CEST 2011
You forgot to process the tail part of the scanned string. Do something
with the tl binding in the scan function. Note that the scan function
returns Token and not [Token].
On Mon, 2011-10-17 at 20:17 -0600, kolli kolli wrote:
> I am new to haskell plz dnt mind
>
>
> scan :: [Char] -> Token
> scan ('i':'f':tl) = IfKeyword
> scan ('t':'h':'e':'n':tl) = ThenKeyword
> scanp :: [Char] -> [Token]
> scanp t = sequence (map scan t)
>
> when I call scan on my file which has "if then"
> then its just printing if as IfKeyword ..its nt talking the then word
>
> I tried using sequence but its nt working..Can you please help me
> out..
>
> I have to get the output as a list of tokens
>
> [IfKeyword, ThenKeyword]
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list