Sometimes you want to compress an entire list of integers instead of a single number. For example, let's say we want the list [5,9394,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] for whatever reason. In this case, we can use the following instead: •4βŸ{©£MG]q‡dZΘp•94в•5O›YJ&p‘ÑÎ!6 ̄8,•3в Try it online. Try it online.
One thing to note is that it's usually shorter to use a slightly larger single-byte integer constant (i.e. T263т514 for 10,26,36,95,100,255,256,1000 respectively) instead of the maximum+1 found by the program above. Let's say our example [5,94,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] was [5,95,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] instead, it would find •6MÖ∊]ć;?,ćiåÑ6Š•96в (20 bytes) as shortest, but •CRā»ïζyˆö͆y"a±•тв (19 bytes) with the single-byte constant 100 would be 1 byte shorter.
You can still get the compressing program above by replacing the Z> with the single-byte constant (or its value): Try it online .
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)•1∊}•bwith 6 bytes would be even shorter (compressed integer list, with a to binary instead of2в, which implicitly joins)- AndBut
Ž«ǝbĆwith 5 bytes would be the shortest option here (compressed integer, to binary, and enclose - appending its own head)
Sometimes you want to compress an entire list of integers instead of a single number. For example, let's say we want the list [5,93,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] for whatever reason. In this case, we can use the following instead: •4βŸ{©£MG]q‡dZΘp•94в Try it online.
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)•1∊}•bwith 6 bytes would be even shorter (compressed integer list, with a to binary instead of2в, which implicitly joins)- And
Ž«ǝbĆwith 5 bytes would be the shortest option (compressed integer, to binary, and enclose - appending its own head)
Sometimes you want to compress an entire list of integers instead of a single number. For example, let's say we want the list [5,94,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] for whatever reason. In this case, we can use the following instead: •5O›YJ&p‘ÑÎ!6 ̄8,•3в Try it online.
One thing to note is that it's usually shorter to use a slightly larger single-byte integer constant (i.e. T263т514 for 10,26,36,95,100,255,256,1000 respectively) instead of the maximum+1 found by the program above. Let's say our example [5,94,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] was [5,95,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] instead, it would find •6MÖ∊]ć;?,ćiåÑ6Š•96в (20 bytes) as shortest, but •CRā»ïζyˆö͆y"a±•тв (19 bytes) with the single-byte constant 100 would be 1 byte shorter.
You can still get the compressing program above by replacing the Z> with the single-byte constant (or its value): Try it online .
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)•1∊}•bwith 6 bytes would be even shorter (compressed integer list, with a to binary instead of2в, which implicitly joins)- But
Ž«ǝbĆwith 5 bytes would be the shortest option here (compressed integer, to binary, and enclose - appending its own head)
10101001100101001 (usedinitially used in this answer of mine):
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)- But in this case
•1∊}•bwith 6 bytes would be the best optioneven shorter (compressed integer list, with a to binary instead of2в, which implicitly joins) - And
Ž«ǝbĆwith 5 bytes would be the shortest option (compressed integer, to binary, and enclose - appending its own head)
•4Œ"dóŒfÝŸĀTUÕáOyÖOÀÁàu1⁄4616Žr‡_›y3eß2©ǝ2ƶ"SAÎAñ'¡û†Ø(•91вis 57 bytes (generated by compressed integer list generator)•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ2+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)•Bšā¿ÑáζΔÕæ5"®GÙ2®°ƶío"§óÏ4 ̧bćÔ!3ùZFúÐìŸ ,λ2ϦP(Ì•65в2+is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with `2+`2+. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.
10101001100101001 (used in this answer of mine):
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)- But in this case
•1∊}•bwith 6 bytes would be the best option (compressed integer list, with a to binary instead of2в, which implicitly joins)
•4Œ"dóŒfÝŸĀTUÕáOyÖOÀÁàu1⁄4616Žr‡_›y3eß2©ǝ2ƶ"SAÎAñ'¡û†Ø(•91вis 57 bytes (generated by compressed integer list generator)•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ2+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)•Bšā¿ÑáζΔÕæ5"®GÙ2®°ƶío"§óÏ4 ̧bćÔ!3ùZFúÐìŸ ,λ2ϦP(Ì•65в2+is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with `2+`. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.
10101001100101001 (initially used in this answer of mine):
•a1⁄24Ƶ6®í•is 9 bytes (generated by compressed large integer generator)•1∊}•2вJis 8 bytes (generated by compressed integer list generator with added join)•1∊}•bwith 6 bytes would be even shorter (compressed integer list, with a to binary instead of2в, which implicitly joins)- And
Ž«ǝbĆwith 5 bytes would be the shortest option (compressed integer, to binary, and enclose - appending its own head)
•4Œ"dóŒfÝŸĀTUÕáOyÖOÀÁàu1⁄4616Žr‡_›y3eß2©ǝ2ƶ"SAÎAñ'¡û†Ø(•91вis 57 bytes (generated by compressed integer list generator)•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ2+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)•Bšā¿ÑáζΔÕæ5"®GÙ2®°ƶío"§óÏ4 ̧bćÔ!3ùZFúÐìŸ ,λ2ϦP(Ì•65в2+is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with2+. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.
[85,30,29,39,28,37,33,88,31,40,34,89,35,41,32,90,36,38,42,43,44,60,45,61,46,62,47,63,48,64,49,65,81,50,66,51,67,52,68,53,69,86,54,70,87,55,71,56,72,82,57,73,79,80,58,74,59,75,76,77,78,83,84] (used in this answer of mine ):
•4Œ"dóŒfÝŸĀTUÕáOyÖOÀÁàu1⁄4616Žr‡_›y3eß2©ǝ2ƶ"SAÎAñ'¡û†Ø(•91вis 57 bytes (generated by compressed integer list generator)•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ2+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)•Bšā¿ÑáζΔÕæ5"®GÙ2®°ƶío"§óÏ4 ̧bćÔ!3ùZFúÐìŸ ,λ2ϦP(Ì•65в2+is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with `2+`. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.
[85,30,29,39,28,37,33,88,31,40,34,89,35,41,32,90,36,38,42,43,44,60,45,61,46,62,47,63,48,64,49,65,81,50,66,51,67,52,68,53,69,86,54,70,87,55,71,56,72,82,57,73,79,80,58,74,59,75,76,77,78,83,84] (used in this answer of mine ):
•4Œ"dóŒfÝŸĀTUÕáOyÖOÀÁàu1⁄4616Žr‡_›y3eß2©ǝ2ƶ"SAÎAñ'¡û†Ø(•91вis 57 bytes (generated by compressed integer list generator)•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ2+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)•Bšā¿ÑáζΔÕæ5"®GÙ2®°ƶío"§óÏ4 ̧bćÔ!3ùZFúÐìŸ ,λ2ϦP(Ì•65в2+is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with `2+`. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394