LZW compression: Difference between revisions

Content added Content deleted
m (→‎version 2: added a blank line to the output.)
m (→‎version 2: aligned statement.)
Line 4,900: Line 4,900:
$$$= '"There is nothing permanent except change." ─── Heraclitus [540 ── 475 BCE]'
$$$= '"There is nothing permanent except change." ─── Heraclitus [540 ── 475 BCE]'
parse arg text; if text='' then text= $$$ /*get an optional argument from the CL.*/
parse arg text; if text='' then text= $$$ /*get an optional argument from the CL.*/
say 'original text=' text /* [↑] Not specified? Then use default*/
say 'original text=' text /* [↑] Not specified? Then use default*/
cypher= LZWc(text) /*compress text using the LZW algorithm*/
cypher= LZWc(text) /*compress text using the LZW algorithm*/
say 'reconstituted=' LZWd(cypher) /*display the reconstituted string. */
say 'reconstituted=' LZWd(cypher) /*display the reconstituted string. */