Created
April 16, 2021 05:44
-
-
Save gnumonik/1ae4bb58f2535ebbe1deff0129fbb1fc to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test where | |
import Data.Char (toUpper) | |
someFunc :: [Char] -> [[Char]] | |
someFunc xs = go 1 [] xs | |
where | |
go :: Int -> [[Char]] -> [Char] -> [[Char]] | |
go n acc [] = acc | |
go n acc xs = if n <= length xs | |
then go (n + 1) (acc <> [mkUpper n xs]) xs | |
else acc | |
mkUpper :: Int -> [Char] -> [Char] | |
mkUpper n cs = | |
let fs = replicate (n-1) id | |
<> [toUpper] | |
<> replicate (length cs - n) id | |
in zipWith (\x y -> y x) cs fs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment