[String]->[[Bool]] 2
Tn X-10n
kawairashii@hotmail.com
Wed, 13 Aug 2003 16:44:50 +0800
<html><div style='background-color:'><DIV>
<P>[String] contains = ["1 0 0 ","1 0 0","0 1 0"] this [String] is read from a file.</P>
<P>the file shows only: i convert it by using Lines. but i stuck wif the output. </P>
<P>1 0 0</P>
<P>1 0 0</P>
<P>1 0 1<BR></P>
<P>if 1 then False 0 then True</P>
<P>the expected result show be [[False,True,True],[False,True,True],[True,False,True]]</P>
<P> </P>
<P>My code is as followed...</P>
<P>> readF :: String -> IO ()<BR>> readF fname = do x <- (readFile fname)<BR>> putStr (show(conv(words x))) ------------i can't use lines here because change only accepts "0" or "1". but my file contains spaces.</P>
<P>> change :: String -> Bool<BR>> change "1" = True<BR>> change "0" = False<BR></P>
<P>> conv :: [String] -> [Bool]======================unable to declare [[Bool]]<BR>> conv fname = [(change x)| x <- (fname)]<BR></P>
<P><BR> </P></DIV></div><br clear=all><hr>Get <a href="http://g.msn.com/8HMYENSG/2731??PS=">free gift vouchers every week</a> with MSN Premium Vouchers</html>