1
我會怎麼做,如果我想轉的Int
秒的列表,如[1,2,3]
到["∧","∨","→"]
(所以如果有一個「1」,把它變成了「∧」等)列表從INT到特定字符串
我會怎麼做,如果我想轉的Int
秒的列表,如[1,2,3]
到["∧","∨","→"]
(所以如果有一個「1」,把它變成了「∧」等)列表從INT到特定字符串
我可能會做的兩個步驟:
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 = "∧"
...
真棒謝謝你! – user2150839