Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')
Mark code as Haskell.
Source Link
ferada
  • 11.4k
  • 25
  • 65

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................
................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')
pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')

Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern.

For example: mapM_ putStrLn (pattern 48 '.' '+')

................................................
.+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+.
+.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+
................................................

This idea is inspired by Writing nested for loops to produce certain output (but more general).

I am pretty satisfied with my code to solve this problem:

pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')
Source Link
Caridorc
  • 28k
  • 7
  • 54
  • 137
Loading
lang-hs

AltStyle によって変換されたページ (->オリジナル) /