Tips for golfing in 05AB1E Do you have any tips for code-golfing in 05AB1E, a golfing language created by Adnan?

Your tips should be at least somewhat specific to 05AB1E.

Please post one tip per answer.
Since it wasn't part of the Wiki on 05AB1E's GitHub pages (I think it should), I'm just gonna add it here now that I better understand it myself.

How to use the dictionary?

05AB1E has the following words.ex dictionary file containing all the words it knows. But how do we access the words in this dictionary? Let's take the word "testing" as example:

"testing" can be found on row 1453 of the dictionary file. Since the first two lines aren't words, and we need the 0-indexed word, we subtract 3.
So, now we have the index (1450), but how to use it?

We open and start a compressed string with “†. We then look at the second column of the info.txt file. (So € is 00; ‚ is 01; etc.)
In the case of "testing" this means î (14) and » (50).

The compressed String for "testing" is therefore: “î»“ Try it online. As with almost all 05AB1E pieces of code, the trailing “ is optional if you don't access the string, so without works as well in this case.

Some things to note:

All characters that doesn't have any index in the info.txt file can be used as is. This can be useful for adding an s to output a plural instead of singular word or use punctuation like ,.?! for example.
ÿ (string-interpolation) can also be used when you want to insert values from the stack within the string.
NOTE: Every loose character that doesn't have any index in the info.txt file counts as a word for the compression types below.

† There are different types of compressed strings you can use:


': Take a single compressed word as is (no trailing ' required) - 'î»: "testing"
„: Takes two compressed words with space delimiter (no trailing „ required) - „î»î»: "testing testing"
…: Takes three compressed words with space delimiter (no trailing … required) - …î»î»î»: "testing testing testing"
“: Take the compressed string with space delimiter - “î»î»“: "testing testing"
’: Take the compressed string as is without implicit spaces - ’î»î»’: "testingtesting"
”: Take the compressed string in title-case with space delimiter - ”î»î»”: "Testing Testing"
‘: Take the compressed string in full uppercase with space delimiter - ‘î»î»‘: "TESTING TESTING"


Here a useful program to get the compressed string based on a space-delimited input of words:

'“? lAð«Ã#¸˜ vyU "€‚ƒ„…†‡ˆ‰Š‹ŒŽ•–—™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîï" Dâ vy"“ÿ“".V XlQi y?1#] '“,


Try it online.

This program will:


Take the input as lowercase, removes any non-alphabetic characters (except for spaces), and then splits the words by spaces (lAð«Ã#), or wraps the words in a list if only a single word was inputted (¸˜)
Loops over each word (vyU)
Then has an inner loop over each compressed word from the dictionary ("€...ï"Dâvy), which it will try to run as 05AB1E program ("“ÿ“".V)
And if it's equal to the current word it will print it and break the inner loop XlQiy?1#


With an input good bye world the output would therefore be “‚¿Þ¡‚ï“. Try it online.

NOTE: You'd still have to see if the word exist in the dictionary in order for this generator to work, and it will ignore any special characters or plural words. Only the words that are exactly the same in the dictionary will be found.

Here an example where I use …Ÿ™‚ï! for the string "hello world!" and ’‚¿Þ¡ ÿ ‚ï!’ for the string "goodbye ÿ world!". Note how the spaces and exclamation mark are used as is, because they don't have indices in the info.txt file. In addition, it uses ÿ to insert the "cruel" that was at the top of the stack, which unfortunately wasn't part of the dictionary (but was still compressed using the method at the section below).

How to compress strings not part of the dictionary?

Although the words.ex dictionary file is pretty big (10,000 words to be exact), it can happen that you need a word which isn't part of it, or a string which is just plain gibberish. So is there a way to compress those as well?
There certainly is, by using .•, which is a compressed base-255 alphabet based string. NOTE: This method can only be used for characters in the lowercase alphabet and spaces.

Here is a useful program to convert a word/string to the compressed base-255 alphabet based string:

vAyk})&gt; 27β 255B ".•ÿ•"


Try it online..

What this program above does is:


vAyk})&gt;: Take the 1-indexed alphabet indices of the individual letters of the input, with spaces becoming index 0
27β: Convert these indices from base 27 to a single number
255B: Convert this number to Base-255 using 05AB1E's own code page
".•ÿ•": Places a leading .• and trailing • before this compressed string


Here an example answer where @Kaldo uses .•zíΘ• to compress the word "goose".

How to compress large integers?

Let's say we want to use a very big number for something, but it can't really be retrieved by pow-calculations. For example, let's say we want to access the large integer 18238098189071058293 for whatever reason.

In this case we can use both a leading and trailing • to compress a number in the format [1-9][0-9]+.
The example number above will become •15Y₁Ò'Θpc•. Try it online. Again, just like with the compressed dictionary string, the trailing • can optionally be removed.

Optionally, when the integer is small enough so only 2 compressed characters have to be used, we can use Ž instead, in which case we won't need a trailing byte to close it and the integer is compressed in 3 bytes instead of 4. For example, the integer 13562 would result in •rl•, but because it only uses two characters, it can be Žrl instead.

Also, numbers in the range [101, 355] can be compressed in 2 bytes using Ƶ plus an additional character from 05AB1E's codepage. So for example, Ƶ– can be used for the integer 250. Here an overview of all available numbers. These characters are converted from Base-255 to Base-10, and then 101 is added (since the numbers in the range [0,100] are already 1 or 2 bytes).

How are these 15Y₁Ò'Θpc and rl created? Very simple, the number is converted to Base-255 using 05AB1E's own codepage. So you can use the following program to get a compressed number, for which it will then use Ƶ., Ž.., or •...• depending on the size of the compressed integer:

101 355Ÿså i 101-255B"Ƶÿ" ë 255B Dg2Qi "Žÿ" ë "•ÿ•"


Try it online.

Here an example answer where @Emigna uses •3Èñ• for the integer 246060.

How to compress integer lists?

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&amp;p‘ÑÎ!6¯8,•₃в Try it online.

Here a useful program to generate both this compressed number and the Base we want to convert to:

Z&gt;© β 255B ®s"•ÿ•ÿв"


Try it online.

What this program above does is:


Z&gt;: Get the max number + 1 of the input-list (©: and store it in the register)
β: Convert the input list from base max+1 to a single number
255B: Compress this single number (as we did at the section above)
®s"•ÿ•ÿв": Returns the result in the format: leading •, compressed number, •, max+1, trailing в


Here an example answer where I use •4Œ”dóŒfÝŸĀTUÕáOyÖOÀÁàu¼6¹₆Žr‡_›y³eß₂©ǝ²ƶ"SAÎAñ'¡û†Ø(•91в to compress the list [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].
PS: In this answer •6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-ø`JδŠ₂+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô is an equal-bytes (57) alternative, since all numbers have exactly two digits. In some cases (especially small lists) this can be a shorter alternative.

One thing to note is that it's usually shorter to use a slightly larger single-byte integer constant (i.e. T₂₆₃т₅₁₄ 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&gt; with the single-byte constant (or its value): Try it online.

Integer compression vs Integer list compression:

With these two it can go either way. Sometimes a compressed list is shorter, sometimes a compressed integer, sometimes a completely different alternative is shorter. So always use your own judgment and golfing skills to possibly golf things further, instead of relying on the above generators completely. Here some examples:

[44, 59] (used in this answer of @Emigna):


•A–•60в is 7 bytes (generated by the compressed integer list generator)
•H|•2ô or •H|•2ä or hardcoded 44 59‚ are all 6 bytes
ŽH|2ô or ŽH|2ä are both 5 bytes
But in this case, „,;Ç with 4 bytes would be the best option (codepoints of characters ',' and ';')


[2,4,6,0] (used in this answer of @Emigna):


•3ā•7в is 6 bytes (generated by the compressed integer list generator)
Ž3ā7в is 5 bytes
But in this case, Ž9¦S with 4 bytes would be the best option (compressed integer 2460 to a list of digits)


10101001100101001 (initially used in this answer of mine):


•a½₄Ƶ6®í• is 9 bytes (generated by compressed large integer generator)
•1∊}•2вJ is 8 bytes (generated by compressed integer list generator with added join)
•1∊}•b with 6 bytes would be even shorter (compressed integer list, with a to binary instead of 2в, which implicitly joins)
But Ž«ǝbĆ with 5 bytes would be the shortest option here (compressed integer, to binary, and enclose - appending its own head)


[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ÀÁàu¼6¹₆Žr‡_›y³eß₂©ǝ²ƶ"SAÎAñ'¡û†Ø(•91в is 57 bytes (generated by compressed integer list generator)
•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ₂+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)
•Bšā¿ÑáζΔÕæ₅"®GÙ₂®°ƶío"§óÏ4¸bćÔ!₃ùZFúÐìŸ
,λ₂Ï¦P(Ì•65в₂+ is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with ₂+. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.