[ Term Manipulation | Reference Manual | Alphabetic Index ]
array_list(?Array, ?List)
Conversion between array and list
- Array
- Array, i.e. structure with functor []/?, or variable
- List
- List, or variable
Description
Converts lists to arrays and vice versa. The behaviour is identical to
array_list(A, L) :- A =.. [[]|L].
except for error handling.
The elements in the Array and List are identical and in the same order.
Modes and Determinism
- array_list(+, -) is det
- array_list(-, +) is det
Exceptions
- (4) instantiation fault
- Both Array and List are variables (non-coroutining mode only)
- (5) type error
- Array is not an array, or List is not a list
Examples
?- array_list([](a,b,c,d,e,f), L).
L = [a,b,c,d,e,f]
?- array_list(A, [a,b,c,d,e,f]),
A = [](a,b,c,d,e,f)
?- array_list([], L).
L = []
?- array_list(A, []),
A = []
?- array_list([]([](a,b),[](c,d)), L).
L = [ [](a,b), [](c,d) ]
See Also
dim / 2, subscript / 3, array_concat / 3, is_array / 1, array_flat / 3, arg / 3