有人可以解释这个yarn top命令的输出吗?我的意思是这些快捷方式(#CONT #RCONT VCORES RVCORES MEM RMEM VCORESECS MEMSECS %PROGR TIME NAME)到底意味着什么以及这些数字是如何计算的?
我有getLinesIn = liftM lines . getContents比
readAndWriteIn = do
list <- getLinesIn
Run Code Online (Sandbox Code Playgroud)
它不起作用.它说:无法匹配预期类型a0 - > m0字符串与实际类型IO字符串.我不明白为什么会这样?当我使用getLinesFile = liftM lines . readFile
它工作正常.我需要对getContents做同样的事情.有办法吗?
谢谢你的任何想法.
编辑:完整输出:
Couldn't match expected type `a0 -> m0 String'
with actual type `IO String'
In the second argument of `(.)', namely `getContents'
In the expression: liftM lines . getContents
In an equation for `getLinesIn':
getLinesIn = liftM lines . getContents
Run Code Online (Sandbox Code Playgroud) 我正在尝试用逗号打印列表。我有类似的列表["1","2","3"],我想打印1,2,3
我该怎么做?
我试过:
printList xs = mapM_ (\(a) -> do
putStr a
putStr (",")) xs
Run Code Online (Sandbox Code Playgroud)
但我不知道如何删除最后一个逗号。
我有以下字符串列表:
["1,AA,3","4,BB,6","7,CC,9"]
Run Code Online (Sandbox Code Playgroud)
我想得到像元组列表:
[(1,AA,3),(4,BB,6),(7,CC,9)]
Run Code Online (Sandbox Code Playgroud)
请帮忙.谢谢
编辑:
我尝试过类似的东西:
tuples (x:xs) = do
foo ++ splitOn "," x
tuples xs
return foo
Run Code Online (Sandbox Code Playgroud)
这可能会给我列表如下:
"1,AA,3,4,BB,6,7,CC,9"
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将它转变为元组.
AA,BB,CC应该是字符串.
另外我想如果在列表中将是这样的:
["1,AA,3","4,,6","7,CC,9"]
Run Code Online (Sandbox Code Playgroud)
转变为
[(1,"AA",3),(4,6),(7,"CC",9)]
Run Code Online (Sandbox Code Playgroud)