<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>runLengthEncode(VisibleList) -- run length encoding</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_same.html">next</a> | <a href="_run__Hooks_lp__Symbol_cm__Thing_rp.html">previous</a> | <a href="_same.html">forward</a> | <a href="_run__Hooks_lp__Symbol_cm__Thing_rp.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>runLengthEncode(VisibleList) -- run length encoding</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>runLengthEncode x</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_run__Length__Encode_lp__Visible__List_rp.html" title="run length encoding">runLengthEncode</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>x</tt>, <span>a <a href="___Visible__List.html">visible list</a></span></span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span>a list equivalent to <tt>x</tt>, in which runs and sequences have been expressed symbolically as <a href="___Expression.html">expressions</a></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><p>The result is useful in printed displays, as a way of making them more compact. The original list can be recovered by appying <a href="_value.html" title="evaluate">value</a> to the elements of the result, and then using <a href="_deep__Splice.html" title="remove subsequences">deepSplice</a>, provided that <tt>x</tt> contains no entries that are sequences.</p> <table class="examples"><tr><td><pre>i1 : x = {1,2,3,a,b,c,a,b,c,4,4,4,"asdf"};</pre> </td></tr> <tr><td><pre>i2 : y = runLengthEncode x o2 = {1..3, 2:a..c, 3:4, asdf} o2 : List</pre> </td></tr> <tr><td><pre>i3 : peek y o3 = {BinaryOperation{.., 1, 3}, BinaryOperation{:, 2, a..c}, ------------------------------------------------------------------------ BinaryOperation{:, 3, 4}, Holder{asdf}}</pre> </td></tr> <tr><td><pre>i4 : value \ y o4 = {(1, 2, 3), ((a, b, c), (a, b, c)), (4, 4, 4), asdf} o4 : List</pre> </td></tr> <tr><td><pre>i5 : deepSplice \\ oo o5 = {1, 2, 3, a, b, c, a, b, c, 4, 4, 4, asdf} o5 : List</pre> </td></tr> <tr><td><pre>i6 : x === oo o6 = true</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="___Binary__Operation.html" title="the class of all binary operation expressions">BinaryOperation</a> -- the class of all binary operation expressions</span></li> <li><span><a href="___Holder.html" title="the class of all holder expressions">Holder</a> -- the class of all holder expressions</span></li> </ul> </div> </div> </body> </html>