<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ARle_Decompress</id>
	<title>TI-BASIC:Rle Decompress - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ARle_Decompress"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Rle_Decompress&amp;action=history"/>
	<updated>2026-04-06T17:08:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=TI-BASIC:Rle_Decompress&amp;diff=1368&amp;oldid=prev</id>
		<title>Maintenance script: Automated @@ correction</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Rle_Decompress&amp;diff=1368&amp;oldid=prev"/>
		<updated>2016-02-24T22:11:26Z</updated>

		<summary type="html">&lt;p&gt;Automated @@ correction&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:11, 24 February 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Template:TI-BASIC:Routine&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Template:TI-BASIC:Routine&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|picture=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@@&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|picture=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|summary=Decompresses a run length-encoded list.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|summary=Decompresses a run length-encoded list.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|input=&amp;#039;&amp;#039;L₁&amp;#039;&amp;#039; - The compressed list&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|input=&amp;#039;&amp;#039;L₁&amp;#039;&amp;#039; - The compressed list&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|variable=L₁, I, J&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|variable=L₁, I, J&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|compatibility=TI-83/84/+/SE&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|compatibility=TI-83/84/+/SE&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|author=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@@&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|author=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|authors=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@@&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|authors=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|url=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@@&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|url=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|download=http://tibasicdev.wikidot.com/local--files/rle-decompress/rledecompress.zip rledecompress.zip&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|download=http://tibasicdev.wikidot.com/local--files/rle-decompress/rledecompress.zip rledecompress.zip&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=TI-BASIC:Rle_Decompress&amp;diff=930&amp;oldid=prev</id>
		<title>Maintenance script: Initial automated import</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Rle_Decompress&amp;diff=930&amp;oldid=prev"/>
		<updated>2016-02-24T18:25:54Z</updated>

		<summary type="html">&lt;p&gt;Initial automated import&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Template:TI-BASIC:Routine&lt;br /&gt;
|picture=@@&lt;br /&gt;
|summary=Decompresses a run length-encoded list.&lt;br /&gt;
|input=&amp;#039;&amp;#039;L₁&amp;#039;&amp;#039; - The compressed list&lt;br /&gt;
|output=&amp;#039;&amp;#039;L₁&amp;#039;&amp;#039; - The decompressed list&lt;br /&gt;
|variable=L₁, I, J&lt;br /&gt;
|compatibility=TI-83/84/+/SE&lt;br /&gt;
|author=@@&lt;br /&gt;
|authors=@@&lt;br /&gt;
|url=@@&lt;br /&gt;
|download=http://tibasicdev.wikidot.com/local--files/rle-decompress/rledecompress.zip rledecompress.zip&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 :dim(L₁→J&lt;br /&gt;
 :sum(E3fPart(L₁)+not(fPart(L₁→dim(L₁&lt;br /&gt;
 :For(I,Ans,1,-1&lt;br /&gt;
 :int(L₁(J→L₁(I&lt;br /&gt;
 :If .001&amp;lt;fPart(L₁(J:Then&lt;br /&gt;
 :L₁(J)-.001→L₁(J&lt;br /&gt;
 :Else&lt;br /&gt;
 :J-1→J&lt;br /&gt;
 :End:End&lt;br /&gt;
&lt;br /&gt;
[wikipedia:Run-length_encoding Run-length encoding (RLE)] is a very easy compression algorithm that you can use for compressing a list of numbers. The way it works is that you remove all of the consecutive repeated numbers from the list, and modify the first instance of the numbers with how many repeated numbers there were.&lt;br /&gt;
&lt;br /&gt;
For example, say you have a list of numbers 1,2,2,3,3,3,4. You start with the 1, and since there is only one 1, it wouldn&amp;#039;t be modified. There are two 2&amp;#039;s, however, so you would remove the second two, and add a decimal part (using [[TI-BASIC:Fpart|FPart(]]) of how many 2&amp;#039;s there were (in this case, just two, which we represent as .002). You would do this for the rest of the list, and the final list would be 1,2.002,3.003,4.&lt;br /&gt;
&lt;br /&gt;
This routine could loosely be described as the [[TI-BASIC:Rle_Compress|RLE compression]] routine, but backwards. We start by calculating the length of the decompressed list. This is the sum of the length of the runs -- E3fPart(L₁) -- plus the number of elements with no runs -- not(fPart(L₁)). Here E represents the [[TI-BASIC:E_Ten|scientific E]].&lt;br /&gt;
&lt;br /&gt;
Then, the decompression begins. The routine keeps the following loop invariants (things that stay true after each iteration of the loop):&lt;br /&gt;
&lt;br /&gt;
* Every element after the Ith element is the correct decompressed element in that spot.&lt;br /&gt;
* The portion of the list up to and including the Jth element is the compressed version of the list elements that will be 1 through I.&lt;br /&gt;
&lt;br /&gt;
We &amp;quot;unpack&amp;quot; one element from the end of the compressed portion: int(L₁(J→L₁(I. Then we test if this compressed portion is a run that still contains more elements. If it is, we subtract .001, reducing the number of elements in the run by 1. If it&amp;#039;s not, we decrease J by 1 to move on to the previous compressed element. As you can see, the conditions listed above are still true.&lt;br /&gt;
&lt;br /&gt;
Once the loop ends, the first condition of the ones above ensures that all elements have been correctly decompressed.&lt;br /&gt;
&lt;br /&gt;
Note that we never store anything to L₁ itself, only to its elements. This is done to avoid using any more memory than necessary: if we stored to L₁, a copy of the list would get temporarily stored to Ans, and we would be using twice the memory we need. This way, the routine will work even for large lists. As a bonus, the only time we change the size of the list is the very beginning. So if the decompressed list wouldn&amp;#039;t fit in memory, the routine crashes immediately and keeps the list intact.&lt;br /&gt;
&lt;br /&gt;
= Error Conditions =&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;[[TI-BASIC:Errors#memory|ERR:MEMORY]]&amp;#039;&amp;#039;&amp;#039; is thrown if there is not enough space to store the decompressed list. &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;[[TI-BASIC:Errors#invaliddim|ERR:INVALID DIM]]&amp;#039;&amp;#039;&amp;#039; is thrown if the decompressed list would be longer than 999 elements.&lt;br /&gt;
&lt;br /&gt;
= Related Routines =&lt;br /&gt;
&lt;br /&gt;
* [[TI-BASIC:Rle_Compress|RLE Compression]]&lt;br /&gt;
* [[TI-BASIC:Rle_Compress_String|RLE Decompression for Strings]][[Category:TI-BASIC]]&lt;br /&gt;
[[Category:TIBD]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>