2022 Developer Survey is open! Take survey.

New answers tagged

0 votes

I want 8 bits for every character!

Ignores the transformation process and just decodes Burlesque, 45 bytes id[-sab2L[PpqsvZ]vv{b28'0P[}\mpPco)b2:nzqgv\m Try it online! ...
user avatar
2 votes

Who needs 8 bits for one character?

MATL, 17 bytes &m2Gt&mBwY)!8e!XB Try it online! Of note, B returns a matrix with the binary strings as rows, so they ...
user avatar
  • 26.6k
1 vote

I want 8 bits for every character!

Pip -x, 26 bytes b@DFBFI(STB_+E8MJa)<>#TB#b Takes a list and a string as command-line arguments. The string may need to ...
user avatar
  • 31.8k
0 votes

I want 8 bits for every character!

Jelly, 17 bytes BUz0ZUFsLBLƊ}Ḅt0ị A dyadic Link that accepts the code on the left and the alphabet on the right and yields the plain text. Try it online! How? <...
user avatar
0 votes

I want 8 bits for every character!

Charcoal, 26 bytes Φ⭆⪪⭆θ◧⍘ι !⁸L↨L粧⁺ψη⍘ι !℅ι Try it online! Link is to verbose version of code. Explanation: ...
user avatar
  • 142k
1 vote

I want 8 bits for every character!

JavaScript (ES7),  99  95 bytes Expects (encoder_characters)(stream). ...
user avatar
  • 166k
1 vote

I want 8 bits for every character!

Python 3, 112 bytes lambda s,e,j=''.join:j(map(lambda*a:['',*e][int(j(a),2)],*[iter(j(map('{:08b}'.format,s)))]*len(f'{len(e):b}'))) Try it online! Basically the ...
user avatar
  • 6,240
1 vote

I want 8 bits for every character!

Python, 139 bytes lambda L,E:(n:=len(bin(len(E)))-2)and"".join(["",*E][int("".join(bin(i)[2:].rjust(8,"0")for i in L)[i:i+n],2)]for i in range(0,len(L)*8,n)) ...
user avatar
  • 991
1 vote

Who needs 8 bits for one character?

Desmos, 304 265 bytes ...
user avatar
  • 4,026
2 votes

I want 8 bits for every character!

PARI/GP, 70 bytes f(p,e)=[e[i]|i<-digits(fromdigits(p,256)>>(8*#p%l=#binary(#e)),2^l),i] Attempt This Online! Inputs and outputs lists of characters.
user avatar
  • 32.8k
1 vote

Who needs 8 bits for one character?

PARI/GP, 90 bytes f(s,e)=digits(fromdigits([[i|i<-[1..#e],e[i]==c][1]|c<-s],2^l=#binary(#e))<<(-l*#s%8),256) Attempt This Online! Inputs lists of ...
user avatar
  • 32.8k
2 votes

I want 8 bits for every character!

J, 35 31 bytes ((]i.0-.~($@]$!.0,@[)&.#:)#\){] Try it online!
user avatar
  • 26.6k
7 votes

I want 8 bits for every character!

Vyxal, 16 bytes b8∆Zf⁰LbLẇvBꜝ‹İ∑ Try it Online! ...
user avatar
  • 27.2k
0 votes

Random Pixels Image Compression

Yabasic, 196 bytes Program that takes input \$n\$ from STDIN and outputs to a 'grafic' window. ...
user avatar
0 votes

Random Pixels Image Compression

Excel VBA, 145 bytes An anonymous immediate window function that takes input from [A1] and outputs to the active worksheet. Clear input on execution. ...
user avatar
2 votes

Random Pixels Image Compression

Wolfram Language (Mathematica), 93 bytes Image/@NestList[BlockMap[Boole[#~Total~2+r[]>2]&,#,{2,2}]&,r=RandomInteger;1~r~{#,#},Log2@#]& Try it online!...
user avatar
  • 32.8k
2 votes

Random Pixels Image Compression

J, 91 bytes load'viewmat' [:viewmat[:,.~/[:>:&>(,:~2 2)0:`(?@2)`1:@.(1+_2*@++/@,);._3&.:>^:a:[:<,~?@$2: Try it online! Output from the above is ...
user avatar
  • 26.6k
3 votes

Random Pixels Image Compression

JavaScript (browser), 334 bytes ...
user avatar
  • 142k
2 votes

Random Pixels Image Compression

C (GCC), 296 bytes ...
user avatar
  • 1,222
1 vote

Write two programs that compress and decompress data

Mathematica, 9 bytes + 11 bytes, rate: 0.565899. Score: 6.40483 Mathematica, of course, has builtins for this. This makes this answer a bit of a cheat, but I thought I should include it anyway. ...
user avatar
  • 461
1 vote

Who needs 8 bits for one character?

Ruby, 128 120 118 bytes First attempt, probably some ways to make it more optimal ...
user avatar
  • 3,739
1 vote

Who needs 8 bits for one character?

Julia 1.7, 125 bytes ...
user avatar
  • 4,824
2 votes

Who needs 8 bits for one character?

Python 3, 116 bytes lambda s,e,j=''.join:map(lambda*a:int(j(a),2),*[iter(j(f"{e.find(c)+1:0{len(bin(len(e)))-2}b}"for c in s)+7*'0')]*8) Try it online! ...
user avatar
  • 6,240
2 votes

Who needs 8 bits for one character?

05AB1E, 17 bytes āb¤g°+€¦‡¾8׫8ô¨C Inputs in reversed order, with the encoding string as first input. Try it online or verify all test cases. Explanation: ...
user avatar
1 vote

Who needs 8 bits for one character?

APL+WIN, 45 bytes Prompts for string followed by encoder characters: 2⊥⍉(m,8)⍴(8×m←⌈(⍴n)÷8)↑n←,⍉((⌈2⍟⌈/n)⍴2)⊤n←⎕⍳⎕ Try it online! Thanks to Dyalog Classic
user avatar
  • 5,016
7 votes

Who needs 8 bits for one character?

JavaScript (ES7),  124 122  117 bytes Expects (encoder_characters)(string), where string is passed as an array of characters. <...
user avatar
  • 166k
3 votes

Who needs 8 bits for one character?

Retina, 90 bytes L$`(.?)(?=.*(¶.*)(?!$)\1) $.2* +`(_+)\1 $1 _ _ P^`.+ .+$ 7* ¶ L`.{8} _ _ +`_ __ %`_ Try it online! Explanation: ...
user avatar
  • 142k
2 votes

Who needs 8 bits for one character?

Charcoal, 26 bytes IE⪪⭆θ◧⍘⊕⌕ηι !L↨L粦⁸⍘◨ι⁸ ! Try it online! Link is to verbose version of code. Explanation: ...
user avatar
  • 142k
3 votes

Who needs 8 bits for one character?

Python, 115 bytes lambda s,e,o=0:[*sum(-~e.find(x)<<8*(L:=(l:=len(f"{len(e):b}"))*len(s)+7>>3)-(o:=o+l)for x in s).to_bytes(L,'big')] Attempt This Online! Old Python, 122 ...
user avatar
  • 5,820
2 votes

Who needs 8 bits for one character?

Python 3, 133 132 131 bytes ...
user avatar
  • 17.9k
2 votes

Who needs 8 bits for one character?

Factor, 123 bytes [ dup length [1,b] dup last log2 1 + '[ >bin _ 48 pad-head ] map zip substitute concat 8 group [ 8 48 pad-tail bin> ] map ] Try it online! ...
user avatar
  • 8,748
11 votes

Who needs 8 bits for one character?

Vyxal, 19 bytes ¹żb:∩L∆ZĿf8ẇR8∆ZRvB Try it Online! ...
user avatar
  • 27.2k
5 votes

Who needs 8 bits for one character?

Jelly, 21 bytes JBUz0ZU⁸,yFŻ8¡s8z0ZḊḄ Try It Online! ...
user avatar
  • 40.2k

Top 50 recent answers are included