I'm writing this on my phone, so there are probably errors, I'll check it when I have access to a compiler.
pattern :: Int -> String pattern n | n < 1 = " " | otherwise = pattern' n where pattern' n = unlines $ foldl folder [] $ map show [n,(n-1)..1] folder :: [String] -> String -> [String] folder [] x = [x] folder (p:xs) x = (p ++ x) : p : xs
Edit: fixed issues after running it through a compiler.
I do a lot of these challgnes on my phone. I use rextester.com/l/haskell_online_com... to test my Haskell code a lot.
Thanks for the tip!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Haskell
I'm writing this on my phone, so there are probably errors, I'll check it when I have access to a compiler.
Edit: fixed issues after running it through a compiler.
I do a lot of these challgnes on my phone. I use rextester.com/l/haskell_online_com... to test my Haskell code a lot.
Thanks for the tip!