Integer Compression Tool

• infoInformation

Jelly has four literal types that can represent integers or integer lists shorter than the trivial representation.

ȷ allows multiples of powers of ten to be represented in fewer bytes: xȷy translates to x × 10 ^ y. For example, 2ȷ6 == 2e6 == 2000000. ȷy == 1ey and xȷ == xe3 (so ȷ is a short way of representing 1000).

starts a two-digit base-250 number literal, where ¡ represents 1 and ż represents 250. If the number is greater than 31500, 62850 is subtracted (to allow negative integers to be compressed this way too), and otherwise, 750 is added. This can represent positive numbers between 1001 and 32250, and negative numbers from -31349 to -100 (this is because compressing three-digit numbers wouldn't be helpful, and 1000 can be represented via ȷ). For example, ⁽½¥ evaluates to 3505: Try It Online!

“...’ denotes a longer base-250 number where ¡ represents 1 and ż represents 250 (just like with ). For example, “ṄBṭ/Ḷ£Þ⁻’ evaluates to 12345678901234567890: Try It Online!

“...‘ denotes a code page index list. Here, ¡ represents 0 and ż represents 249, and instead of forming a base-250 number, each character translates to one number, and a list of numbers is returned. For example, “Æ⁺©¬‘ evaluates to [13, 138, 6, 7]: Try It Online!

This utility attempts to compress an integer or list of integers into a literal. Note that often, you can find a shorter way (e.g. [0, 1] is a digraph nilad, Ø., which cannot be used in a literal, but can represent that pair itself shorter than any literal could), but this tool is intended for compressing larger values that don't have intelligent algorithmic representations. For example, you can compress a long list of small integers using base conversion - b converts its left argument into digits with base based on its right argument, and does the inverse.

For example, [1, 3, 2, 6, 5, 3, 7, 4, 6, 3, 4, 2, 5, 3] can be represented using a codepage index list as “¢¤£©¦¤¬¥©¤¥£¦¤‘, but in base 8, it can be 780273924267b8¤ (which is one byte shorter even with the ¤ to make it a single niladic link): Try It Online! (Also, you can compress the number itself to get “İṾ³ĠÑ’b8¤.)

(Warning: the query gets eval'd by JavaScript in your browser, so don't input anything that might brick your browser. If you just enter normal integers and integer lists, nothing will go wrong. If the input contains anything other than square brackets, commas, digits, minus signs, or whitespace, evaluation will stop.)