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.
如果我想将Ints 的列表转换为[1,2,3]to ["∧","∨","→"](因此,如果有 '1' 将其转换为 '∧' 等...),我会怎么做
Int
[1,2,3]
["∧","∨","→"]
我可能会分两步完成:
conv :: Int -> String conv 1 = "∧" conv 2 = "∨" conv 3 = "→"
然后只是映射:
change :: [Int] -> [String] change = map conv change [1,2,3] -- returns ["∧","∨","→"]
你甚至可以嵌入:
change = map conv where conv 1 = "∧" ...