7, 11
结论:
养马人不在黄房子
let filter7_11 (x1, x2, x3, x4, x5, x6) = not ((x4 == 'H') && (x2 == 'Y'))
let l14 = filter filter7_11 l13
let l24 = filter filter7_11 l23
let l34 = filter filter7_11 l33
let l44 = filter filter7_11 l43
let l54 = filter filter7_11 l53
没削去任何条目
哈
看了那个hakell解题的过程
不得不暂时停止了
有点超出自己现在学的了
呵呵
ctnt <- readFile "./abc.txt"
let l = read . concat . lines \$ ctnt ::
print l
读取文件,生成list
写一个List
假设 a是list
writeFile fileName (show a)
fileName类似于"d:\\ghc\\demo.txt"形式
appendFile
File: /tmp/foo.txt :
AAA
Program source:
main = appendFile "/tmp/foo.txt" aaa
aaa= "BBB" ++ "CCC"
File: /tmp/foo.txt :
AAABBBCCC
=====================
readFile
////demo 1
File: /tmp/foo :
BBBCCC
Program source:
main = do x <- readFile "/tmp/foo.txt"
putStr x
Output: BBBCCC
////Demo2
File: /tmp/foo.txt :
Program source:
main = do x <- readFile "/tmp/foo.txt"
y <- rList x
print (sum y)
rList :: String -> IO
rList = readIO
Output: 20
在交互里使用
let rList :: String -> IO ; rList = readIO
呵呵
真的是自我娱乐啊
诗人常自我娱乐么?
;P
呵呵
遇到新东西就记录在这里
Blog那东西不知道什么时候就会玩消失
论坛还有数据备份呢
两个 Int 相除,得到一个 Double 的结果
divInt2Double :: Int -> Int -> Double
divInt2Double a b = (fromIntegral a) / (fromIntegral b)
代码块写法
if C then do {...} else do {...}