[ library(viewable) | Reference Manual | Alphabetic Index ]

# viewable_create(?ViewableName, +Elements)

Create a viewable.

ViewableName
  A string or atom; the name of the new viewable.
Elements
  A possibly nested list or array (as created for example by dim/2).

## Description

NOTE:When there are no registered visualisation clients, this predicate succeeds with any arguments, and has no effect.

This predicate creates a new viewable by specifying its name and elements. The predicate will try to guess the number of dimensions for the new viewable from the level of nesting in Elements. All dimensions are set to `fixed` so they cannot be expanded later. The element type is set to `any`. For more control over the number and fixity of dimensions and the element type, use `viewable_create/3`. In other ways the predicate behaves just like `viewable_create/3`. See the documentation for that predicate for more details.

### Resatisfiable

no

### Exceptions

(4) instantiation fault
  ViewableName is not an atom, string or free variable.
(1) general error
  ViewableName is the name of an existent viewable.
(1) general error
  Elements is not a nested list or array.

## Examples

    [Assuming that at least one visualisation client is registered]

           Success:

           viewable_create(viewable1, [X, Y, Z]).

           viewable_create("viewable1", [](X, Y, Z)).

           viewable_create(m, []).

           viewable_create(var23, [[],[],[]]).

           viewable_create(var315, []([]([](R, T, [E, X, Y]),
                                         [](W, T, grok(D))),
    				  []([](A, B, C),
    				     [](R, E, W)))).

           Exceptions raised:

           viewable_create(2, [x,y,z]).
           [gives error 4]

           viewable_create(v1, [x,y,z]),
           viewable_create(v1, [x,y,z]).
           [gives error 1]

           viewable_create(v1, _).
           [gives error 1]

## See Also

viewable_create / 3, viewable_expand / 3