Converts an object to a list.
Xis any object
X is any object, then
ToList(X) returns a list with the same content as
X, to the extent it is possible.
X isn’t a container,
ToList(X) returns the single-element list
'(X). This applies to numbers, booleans, colours, and sounds.
X is a container,
ToList(X) returns a list of all the elements in
X is an ordered container (e.g., a vector, a matrix, or a list), the elements in
ToList(X) have the same order as in X. Otherwise (e.g., if
X is a set), the order of the elements in
ToList(X) is undefined. If
X is a planar container (e.g., a matrix or a pixmap), row-major order is used.
These object types include vectors, matrices, lists, sets, strings, structures, and pixmaps. In the case of strings and pixmaps, the elements are characters and colours, respectively.
To obtain the characters of a string
characters(s) can be used, and the results are identical.
characters is the preferred function in this case.
Type conversion functions (list)