Better HN
topnewbestaskshowjobs
Log inSign up

homic

1 karma · joined Aug 20, 2012 (14y ago) · 6 submissions

Submissions

comment 5y ago · link · parent

I attempted this as a Haskell beginner. Positive it can be improved upon.

    runLengthEncode :: String -> [(Char, Int)]
    runLengthEncode [] = []
    runLengthEncode input =
        let 
            chFirst = head input
            zipped = zip input $ chFirst : input
        in 
            rle zipped (chFirst, 0)
        where 
            rle :: [(Char, Char)] -> (Char, Int) -> [(Char, Int)]
            rle [] (ch, count) = [(ch, count)]
            rle ((ch1, ch2) : cs) (ch, count) = 
                if ch1 == ch2 then
                    rle cs (ch1, count + 1)
                else 
                    (ch2, count) : rle cs (ch1, 1)

2.

Async / Await at the Gym(medium.com ↗)

1 points · by homic · 10y ago · discuss

3.

Pipeline Style Programming in C#. Inspired by F#.(pipelinestyle.codeplex.com ↗)

1 points · by homic · 14y ago · discuss

4.

Alternate Azure Table Storage Client - Open Sourced(lucifurestash.codeplex.com ↗)

1 points · by homic · 14y ago · discuss