Live data from Hacker News

Merry Christmas to HN

news.ycombinator.com

51–60 of 122 posts

Re: Merry Christmas to HN

#53
post #26

map (\x -> chr (x + 32)) [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]

    #include 
    #include 
    #include 
    using namespace std;

    int main() {
        string s {33,78,68,0,65,0,40,65,80,80,89,0,46,69,87,0,57,69,65,82,0,79,70,0,
                  70,85,78,67,84,73,79,78,65,76,0,67,79,68,69,0,84,79,0,89,79,85,0,
                  84,79,79,12,0,51,73,82,1};
        transform (begin(s), end(s), begin(s), [](char c){ return c + 32; });
        cout 

Re: Merry Christmas to HN

#58
post #48
post #39

Earlier quoted context omitted.

What language is this?

Haskell. Here's another way to do it in the same language, using function composition and point-free style. map (chr . (+32)) [45, 69, 82, 82, 89, 0, 35, 72, 89, 73, 83, 84, 77, 65, 83, 1]

Merry Xmas. I thought I'd try Haskell for the same time for Xmas and found I have to download it and import Data.Char first in case anyone else is trying!
Post reply on HN