[ Term Manipulation | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

dim(?Term, ?Dimensions)

Creates a multi-dimensional array in the form of nested structures, or computes the dimensions of an existing matrix.
?Term
Variable or structure.
?Dimensions
Variable or list of integers.

Description

Creates a multi-dimensional array in the form of nested structures, or computes the dimensions of an existing matrix.

When creating an array of dimensions [D1,..,Dn], a nested structure is created with the top-level term having the functor []/D1, its arguments being structures with functor []/D2, and so on. The functor [] is chosen to remind of arrays, but is otherwise not significant.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) instantiation fault
Both Term and Dimensions are not sufficiently instantiated.
(5) type error
Dimensions is not a list of integers.

Examples

[eclipse]: dim(M,[3,4]), dim(M,L).
M = []([](_131, _132, _133, _134),
       [](_126, _127, _128, _129),
       [](_121, _122, _123, _124))
L = [3, 4]
yes.



See Also

arg / 3, subscript / 3, functor / 3