Haskell simultaneously accepts and deletes

I was wondering how I can achieve:

Taking the first n characters of the string, then ++(combining them), discard these first n and take the next n and so on (without cutting words). I tried the composition of the function and $, but the only thing I get is errors.

EDIT

I'm trying to align the text on the left for a given column width (n), so I try not to cut out the words, but if there is a word among n, just take some characters in front of it and then use \ n to start again for the next line. My main problems so far are checking the cut-words condition (I can use it !!, but should I use it in security devices with a map (-1) or how else) and implement recursion, because as the base I got

take n s ++ "\n" ++ take n (drop n s)

and also the case when n is less than the longest word:

leftAlign n str = if n < ((maximum . map length . words) str) then "" else leftAlign n str
+4
source share
1 answer
-1
source

All Articles