Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个像
列表 :: [(Char, Int)]
使所有可能的对(元组)在 1-10 和 AJ 之间
(输出:A1、A2、A3、... J9、J10)
但我不知道该怎么办。
您可以使用列表推导:
[(a,b) | a <- "ABCDEFGHIJ", b <- [1..10]]
您的声明将如下所示:
list :: [(Char, Int)] list = [(a,b) | a <- "ABCDEFGHIJ", b <- [1..10]]