7 ms·
map (\x -> chr (x + 32)) [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]
by jarcane 12y ago
map (\x -> chr (x + 32)) [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1]
- mrwnmonm 12y agoexplain :)
- hundunpao 12y agoJavascript [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('')
- krat0sprakhar 12y agoCopy-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("") );
- zuppy 12y agoI'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.
- awhitty 12y agoPython 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 :)
- heinrich5991 12y agoPython 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]))
- adregan 12y agoOr 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]])
- jarcane 12y ago; 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)))
- kevinavery 12y agoScala List(45,69,82,82,89,0,35,72,89,73,83,84,77,65,83,1) map (_ + 32 toChar) mkString
- sysk 12y agoWhat language is this?
- malokai 12y agoHaskell. 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]
- tim333 12y agoMerry 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!
- peterwwillis 12y agoOr 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)
- deleted 12y ago[deleted]
- nly 12y ago#include <string> #include <iostream> #include <algorithm> 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 << s << endl; }
- roskilli 12y agoCoffee: [45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1].map((x) -> String.fromCharCode x+32).join('')
- jarcane 12y agoLast one, in old-fashioned style: 5 FORX=1TO16:READN:N=N+32:?CHR$(N);:NEXTX:DATA45,69,82,82,89,0,35,72,82,73,83,84,77,65,83,1