LZW compression: Difference between revisions

Content added Content deleted
No edit summary
Line 1,770: Line 1,770:
fun decompress = text by List compressed
fun decompress = text by List compressed
Map dictionary = int%text[].with(256, <int i|int%text(i => chr(i)))
Map dictionary = int%text[].with(256, <int i|int%text(i => chr(i)))
text w = chr(compressed.delete(0))
text w = chr(compressed[0])
text result = *w
text result = *w
for each int k in compressed
for each int k in compressed.extract(1)
text entry
text entry
if dictionary.has(k)
if dictionary.has(k)