[ Obsolete | Reference Manual | Alphabetic Index ]

flatten_array(+Array, -List)

Returns a flat list of the elements of a multi-dimensional array.
Array
Array.
List
List of terms.

This built-in predicate is obsolete!

Description

List is unified with a flat list of the elements of the array Array. The elements are returned in the same order as they would be encountered in a depth-first left-to-right traversal of the array structure.

Modes and Determinism

Exceptions

(4) instantiation fault
Array is a variable.
(5) type error
Array is not an array.

Examples

?- flatten_array([]([](a,b,c),[](d,e,f)), List).
List = [a, b, c, d, e, f]
yes.
?- flatten_array([](a,b,c), List).
List = [a, b, c]
yes.
?- flatten_array([](a(b),[c,d],[]), List).
List = [a(b), [c, d], []]
yes.
?- flatten_array(Array, List).
instantiation fault in flatten_array(Array, List)
Abort
?- flatten_array([a,b,c], List).
type error in flatten_array([a,b,c], List)
Abort

See Also

dim / 2, subscript / 3, lists : flatten / 2