jim burton <[EMAIL PROTECTED]> writes:
(snip)
> *Main> fifths "IDOLIKETOBEBESIDETHESEASIDE"
> "IDOLI KETOBE BESIDE THESEA SIDEXX"
> *Main> fifths "12345"
> "1 23 45"
(snip)

FWIW this unholy thing works for me,

fifths :: String -> String

fifths = splitIntoN 5

splitIntoN :: Int -> String -> String

splitIntoN n string = 
    let stringToSplit = string ++ replicate (n-1) 'X'
    in unwords (map fst (take n (tail (iterate (splitAt (div (length 
stringToSplit) n) . snd) (undefined, stringToSplit)))))

Admittedly, a 'let' might be nice to name some intermediate
computations.

-- Mark

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to