string - Haskell take and drop at the same time -


i wondering how can achieve:

taking first n characters of string ++(concatenating them with) drop these first n , take next n , on (without cutting words). have tried function composition , $ thing get, errors.

edit

i trying align text left given column width (n), that's why try not cut words, if there word @ number n , take chars before , use \n start again next line. main problems far checking cut-words condition(i can use !! should use in guards map(-1) or how else) , implementing recursion because base got

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

and case n smaller longest word:

leftalign n str = if n < ((maximum . map length . words) str) "" else leftalign n str 

data.list.split.chunksof this.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -