Re:Merry Christmas to HN
by mrwnmonm on Thursday December 25, 2014 @03:38AM
(#8795838)
explain :)
[ Parent
| on HN ]
Re:Merry Christmas to HN
by krat0sprakhar on Thursday December 25, 2014 @03:47AM
(#8795850)
Copy-paste in your browser console -
// Merry Christmas
console.log(
[45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]
.map(function(i) { return i + 32; })
.map(function(i) { return String.fromCharCode(i); })
.join("")
);Javascript
[45, 69, 82, 82, 89, 0, 35, 72, 82, 73, 83, 84, 77, 65, 83, 1].map(function(x){ return String.fromCharCode(x +32)}).join('') ; Racket version
(apply string (map (λ (x) (integer->char (+ x 32))) '(45 69 82 82 89 0 35 72 82 73 83 84 77 65 83 1)))I'm to lazy to do the math (substract and look for ascii code), but it should be "Merry Christmas". clue: look where "r" is i the string.
Python equivalent for convenience:
map(lambda x: chr (x + 32), [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1])
Just paste it into a python terminal and run it :)
Re:Merry Christmas to HN
by heinrich5991 on Thursday December 25, 2014 @05:42AM
(#8795990)
Python 2/3 compatiblity:
"".join(map(lambda x: chr (x + 32), [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]))Or as a list comprehension if that's your thing:
"".join([chr(x + 32) for x in [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]])
Re:Merry Christmas to HN
by kevinavery on Thursday December 25, 2014 @12:27PM
(#8796679)
Scala
List(45,69,82,82,89,0,35,72,89,73,83,84,77,65,83,1) map (_ + 32 toChar) mkString