我试图在Haskell中合并两个排序列表.这两个列表必须包含相同的类型,但该函数需要采用不同类型的列表.
这就是我所拥有的(我知道我需要一些代码来避免尝试从空列表中取出元素):
merge :: Ord a => [a] -> [a] -> [a]
merge [] [] = []
merge (h:first) (c:second) | h <= c = h:merge first (c:second)
| h > c = c:merge (h:first) second
main = merge ['a','b','c'] ['d','e','f']
Run Code Online (Sandbox Code Playgroud)
问题是我是Haskell的新手,我得到了这个错误消息,我有点理解,但不知道要做什么:
Couldn't match expected type `IO t0' with actual type `[Char]'
In the expression: main
When checking the type of the function `main'
Run Code Online (Sandbox Code Playgroud)
有谁知道这意味着什么?非常感谢帮助!
我试图用gnuplot绘制一些金融烛台图表.问题是周末没有数据,我不希望显示这些差距.图片和代码包含在下面.
set datafile separator ","
set xdata time
set timefmt"%Y-%m-%d"
set xrange ["2015-10-22":"2016-02-06"]
set yrange [*:*]
set format x
plot 'head.dat' using 1:2:4:3:5 notitle with candlesticks
Run Code Online (Sandbox Code Playgroud)