Iconize

Iconize[expr]

gives an iconized form that can be used to stand in for expr in notebook input.

Iconize[expr,"name"]

displays with the specified name in the icon.

Details and Options

  • The formatted output of Iconize[expr] will evaluate to expr when it is supplied as input.
  • It is common to evaluate Iconize[expr] using Evaluate in Place.
  • On many platforms, an expression selected in a notebook can be iconized using the Iconize menu item in the context menu for the selection.
  • An iconized form can be converted to standard form using Convert to StandardForm.
  • With the default setting Method->Automatic, the expression is written as is into the notebook.
  • With the settings Method->Compress and Method->BinarySerialize, the respective functions are used to compress the expression prior to writing it into the notebook.

Examples

open allclose all

Basic Examples  (2)

Create an icon that holds the numbers 1 through 100:

The icon evaluates to the list when used as input:

Create a named icon:

The icon can also be used as input:

Scope  (5)

Iconize strings:

Iconize associations:

Iconize a general expression:

Create named icons:

Use the icons in an expression:

Iconize an unevaluated expression:

The icon contains the unevaluated expression:

Outside of a holding construct, normal evaluation occurs:

Options  (1)

Method  (1)

Create data:

Iconize the data, storing a reference to the output cell for later:

Iconize the data but compress it using Compress:

Iconize the data but compress it using BinarySerialize:

Verify that the sizes of the second and third icons in the notebook are indeed smaller:

Properties & Relations  (3)

Iconize evaluates its argument:

Interpretation allows you to specify an arbitrary appearance of an expression:

The expression is not evaluated by default:

Iconize has a unique appearance and evaluates its argument by default:

Possible Issues  (2)

The typeset output produced by Iconize is not the same as the result of evaluation:

The typeset output evaluates to the first argument of the result:

When using compression, the iconized form may not be fully equivalent to the original expression:

When used inside functions that hold their arguments, the altered expression can be seen:

The original expression is recovered when the iconized form fully evaluates:

Introduced in 2018
 (11.3)
 |
Updated in 2019
 (12.0)