Authors = [(String, Int)]
File Filename DateTime Authors
示例:
File "DSC023.jpg" "01/05/2012 22:40" [("Test1",1),("Test2",2)]
我如何搜索DSC023.jpg并将另一位作者添加到列表中?
findFile n = find (\(File x _ _ _) -> x == n) fileDatabase
答案 0 :(得分:1)
您需要一些功能:
addAuthor author File x y as = File x y (author:as)
fileName File n _ _ _ = n
findFile name = find (\x -> (fileName x) == name)
这应该为您提供构建所需功能的一切。