"Value" (Data Structure)


represents a mutable expression value.


  • A mutable value can be modified in any part of a program:
  • CreateDataStructure["Value",x]create a new "Value" with specified initial value x
    Typed[x,"Value"]give x the type "Value"
  • For a data structure of type "Value", the following operations can be used:
  • ds["Copy"]return a copy of dstime: O(1)
    ds["Get"]get the value stored in dstime: O(1)
    ds["Set",x]set the value of ds to xtime: O(1)
    ds["Visualization"]return a visualization of dstime: O(1)
  • The following functions are also supported:
  • dsi===dsjTrue, if dsi equals dsj
    FullForm[ds]the full form of ds
    Information[ds]information about ds
    InputForm[ds]the input form of ds
    Normal[ds]convert ds to a normal expression


open allclose all

Basic Examples  (1)

A new "Value" can be created with CreateDataStructure:

Extract the value stored:

Insert a new value to be stored:

Confirm that the value has updated:

Return an expression version of ds:

A visualization of the data structure can be generated:

Scope  (2)

Mutability  (1)

The data structure is mutable, so its value can be changed:

Change the value:

Check the value:

Change the value again:

Check the value again:

Information  (1)

A new "Value" can be created with CreateDataStructure:

Information about the data structure ds:

Properties & Relations  (2)

Create an expression:

Create a data structure with the expression:

Check the value of the data structure:

Check that the value of the data structure is the same as the original expression:

Create two "Value" data structures:

Their values are the same:

You can compare the data structures directly:

Change the value of the second data structure:

Their values now differ:

The data structures are no longer the same:

Introduced in 2020