
Hello everybody, can somebody tell me as to what is wrong with the following code myflatten::[(a,a)]->[a] myflatten [] = [] myflatten (fx,sx):xs = fx:sx:(myflatten xs) It says that there is a parse error on the last line.. Thanks, Sunil.

On Tue, Aug 16, 2011 at 11:07 AM, Sunil S Nandihalli
Hello everybody, can somebody tell me as to what is wrong with the following code
myflatten::[(a,a)]->[a] myflatten [] = [] myflatten (fx,sx):xs = fx:sx:(myflatten xs)
It says that there is a parse error on the last line.. Thanks, Sunil.
Hi Sunil, You need to wrap the pattern in parentheses, ie: myflatten ((fx,sx):xs) = fx:sx:(myflatten xs) Michael

thanks Michael
Sunil.
On Tue, Aug 16, 2011 at 1:39 PM, Michael Snoyman
On Tue, Aug 16, 2011 at 11:07 AM, Sunil S Nandihalli
wrote: Hello everybody, can somebody tell me as to what is wrong with the following code
myflatten::[(a,a)]->[a] myflatten [] = [] myflatten (fx,sx):xs = fx:sx:(myflatten xs)
It says that there is a parse error on the last line.. Thanks, Sunil.
Hi Sunil,
You need to wrap the pattern in parentheses, ie:
myflatten ((fx,sx):xs) = fx:sx:(myflatten xs)
Michael

Ah .. I think I realized the problem..
I had to enclose the last pattern with paranthesis .
Thanks,
Sunil.
On Tue, Aug 16, 2011 at 1:37 PM, Sunil S Nandihalli
Hello everybody, can somebody tell me as to what is wrong with the following code
myflatten::[(a,a)]->[a] myflatten [] = [] myflatten (fx,sx):xs = fx:sx:(myflatten xs)
It says that there is a parse error on the last line.. Thanks, Sunil.
participants (2)
-
Michael Snoyman
-
Sunil S Nandihalli