Re:Merry Christmas to HN
by sysk on Thursday December 25, 2014 @04:22AM
(#8795890)
What language is this?
[ Parent
| on HN ]
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!
Re:Merry Christmas to HN
by peterwwillis on Thursday December 25, 2014 @08:22AM
(#8796205)
Or in Perl:
map{chr$_+32}(45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1)
shorter using pack: # shorts
pack("s*",25933,29298,8313,26691,26994,29811,24941,8563)
# longs
pack("l*",1920099661,1749229689,1953720690,561209709)
# 64-bit
pack("q*",7512884309367350605,2410377348306397554)
# hex
pack("h*",d45627279702348627963747d6163712)