News for hackers. Stuff that matters.
Re:Fun with a Functional Programming Interview Question by dirkt on Sunday February 07, 2021 @02:38AM (#26053377)
Haskell in REPL:

    Prelude> :m Data.List
    Prelude Data.List> let f xs = [(head ys, length ys) | ys <- group xs]
    Prelude Data.List> f "aaaabbbcca"
    [('a',4),('b',3),('c',2),('a',1)]
Of course using the "group" function instead of programming it myself is cheating a bit ...

There are no comments on this comment yet.