编程 haskell ——编写一个显示放大字符串的函数,如图
我编写的一部分程序如下,不过运行有误sayit::String->IO()sayit(x:xs)=putStr(sideByside(x:xs))sideByside::...
我编写的一部分程序如下,不过运行有误
sayit :: String -> IO ()
sayit (x :xs) = putStr (sideByside (x : xs))
sideByside :: String -> String
sideByside [ ] = [ ]
sideByside (x : xs) = x ++ sideByside xs
a :: [String]
a = [
" A ",
" A A ",
" A A " ,
" A A ",
" A A A A A ",
" A A ",
" "
]
e :: [String]
e = [
"EEEEEEEE ",
"E ",
"E ",
"EEEEEEE ",
"E ",
"E ",
"EEEEEEEE "
] 展开
sayit :: String -> IO ()
sayit (x :xs) = putStr (sideByside (x : xs))
sideByside :: String -> String
sideByside [ ] = [ ]
sideByside (x : xs) = x ++ sideByside xs
a :: [String]
a = [
" A ",
" A A ",
" A A " ,
" A A ",
" A A A A A ",
" A A ",
" "
]
e :: [String]
e = [
"EEEEEEEE ",
"E ",
"E ",
"EEEEEEE ",
"E ",
"E ",
"EEEEEEEE "
] 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询