开发者

how do I print a list in haskell?

How do I print a list to stdout in Haskell?

Let's say 开发者_如何学运维I have a list [1,2,3] and I want to convert that list into a string and print it out. I guess I could build my own function, but surely Haskell has a function built in to do that.


Indeed there is a built in function, aptly named print.

> print [1,2,3]
[1,2,3]

This is equivalent to putStrLn $ show [1,2,3].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜